diff --git a/pkg/engine/deploy.go b/pkg/engine/deploy.go index 08539eaf4..8e0327f2c 100644 --- a/pkg/engine/deploy.go +++ b/pkg/engine/deploy.go @@ -92,6 +92,7 @@ func (eng *Engine) deployLatest(info *envCmdInfo, opts deployOptions) error { actions := &deployActions{ Ops: make(map[deploy.StepOp]int), Opts: opts, + Target: result.Info.Target, Engine: eng, } summary, _, _, err := result.Walk(actions) @@ -115,10 +116,9 @@ func (eng *Engine) deployLatest(info *envCmdInfo, opts deployOptions) error { colors.SpecAttention, colors.Reset)) } - // Now save the updated snapshot Notee that if a failure has occurred, the Apply routine above will + // Now save the updated snapshot Note that if a failure has occurred, the Apply routine above will // have returned a safe checkpoint. - targ := result.Info.Target - _ = eng.Environment.SaveEnvironment(targ, summary.Snap()) + _ = eng.Environment.SaveEnvironment(actions.Target, summary.Snap()) fmt.Fprint(eng.Stdout, colors.Colorize(&footer)) if err != nil { @@ -139,6 +139,7 @@ type deployActions struct { Ops map[deploy.StepOp]int MaybeCorrupt bool Opts deployOptions + Target *deploy.Target Engine *Engine } @@ -192,4 +193,8 @@ func (acts *deployActions) After(step deploy.Step, status resource.Status, err e fmt.Fprint(acts.Engine.Stdout, colors.Colorize(&b)) } } + + // Write out the current snapshot. Note that even if a failure has occurred, we should still have + // a safe checkpoint. + _ = acts.Engine.Environment.SaveEnvironment(acts.Target, step.Iterator().Snap()) }