diff --git a/pkg/engine/deploy.go b/pkg/engine/deploy.go index 94cc90db0..ded2732e1 100644 --- a/pkg/engine/deploy.go +++ b/pkg/engine/deploy.go @@ -121,7 +121,6 @@ type deployActions struct { Steps int Ops map[deploy.StepOp]int Seen map[resource.URN]deploy.Step - Shown map[resource.URN]bool MaybeCorrupt bool Update Update Opts deployOptions @@ -131,7 +130,6 @@ func newDeployActions(update Update, opts deployOptions) *deployActions { return &deployActions{ Ops: make(map[deploy.StepOp]int), Seen: make(map[resource.URN]deploy.Step), - Shown: make(map[resource.URN]bool), Update: update, Opts: opts, } @@ -144,7 +142,7 @@ func (acts *deployActions) OnResourceStepPre(step deploy.Step) (interface{}, err // Report the beginning of the step if appropriate. if shouldShow(acts.Seen, step, acts.Opts) || isRootStack(step) { var b bytes.Buffer - printStep(&b, step, acts.Seen, acts.Shown, acts.Opts.Summary, false, 0 /*indent*/, acts.Opts.Debug) + printStep(&b, step, acts.Seen, acts.Opts.Summary, false, 0 /*indent*/, acts.Opts.Debug) acts.Opts.Events <- stdOutEventWithColor(&b) } @@ -189,7 +187,7 @@ func (acts *deployActions) OnResourceStepPost(ctx interface{}, // Also show outputs here, since there might be some from the initial registration. if shouldShow(acts.Seen, step, acts.Opts) && !acts.Opts.Summary { - printResourceOutputProperties(&b, step, acts.Seen, acts.Shown, false, acts.Opts.Debug) + printResourceOutputProperties(&b, step, acts.Seen, false, acts.Opts.Debug) } } @@ -206,7 +204,7 @@ func (acts *deployActions) OnResourceOutputs(step deploy.Step) error { // Print this step's output properties. if (shouldShow(acts.Seen, step, acts.Opts) || isRootStack(step)) && !acts.Opts.Summary { var b bytes.Buffer - printResourceOutputProperties(&b, step, acts.Seen, acts.Shown, false, acts.Opts.Debug) + printResourceOutputProperties(&b, step, acts.Seen, false, acts.Opts.Debug) acts.Opts.Events <- stdOutEventWithColor(&b) } diff --git a/pkg/engine/plan.go b/pkg/engine/plan.go index 93d82b733..c9da43c46 100644 --- a/pkg/engine/plan.go +++ b/pkg/engine/plan.go @@ -234,9 +234,7 @@ func isRootStack(step deploy.Step) bool { // stepParentIndent computes a step's parent indentation. If print is true, it also prints parents as it goes. func stepParentIndent(b *bytes.Buffer, step deploy.Step, - seen map[resource.URN]deploy.Step, shown map[resource.URN]bool, - planning bool, indent int, print bool, debug bool) int { - + seen map[resource.URN]deploy.Step, planning bool, indent int, print bool, debug bool) int { for p := step.Res().Parent; p != ""; { par := seen[p] if par == nil { @@ -245,15 +243,13 @@ func stepParentIndent(b *bytes.Buffer, step deploy.Step, // least, it would be ideal to preserve the indentation. break } - - contract.Assert(shown[p]) indent++ p = par.Res().Parent } return indent } -func printStep(b *bytes.Buffer, step deploy.Step, seen map[resource.URN]deploy.Step, shown map[resource.URN]bool, +func printStep(b *bytes.Buffer, step deploy.Step, seen map[resource.URN]deploy.Step, summary bool, planning bool, indent int, debug bool) { op := step.Op() @@ -262,7 +258,7 @@ func printStep(b *bytes.Buffer, step deploy.Step, seen map[resource.URN]deploy.S // their parents, so this often does the right thing, but not always. For instance, we can have interleaved // infrastructure that gets emitted in the middle of the flow, making things look like they are parented // incorrectly. The real solution here is to have a more first class way of structuring the output. - indent = stepParentIndent(b, step, seen, shown, planning, indent, true, debug) + indent = stepParentIndent(b, step, seen, planning, indent, true, debug) // Print the indentation. b.WriteString(getIndentationString(indent, op, false)) @@ -282,9 +278,8 @@ func printStep(b *bytes.Buffer, step deploy.Step, seen map[resource.URN]deploy.S } printResourceProperties(b, step.URN(), step.Old(), step.New(), replaces, summary, planning, indent, op, debug) - // Reset the color and mark this as shown -- we're done. + // Reset the color -- we're done. b.WriteString(colors.Reset) - shown[step.URN()] = true } func printStepHeader(b *bytes.Buffer, step deploy.Step) { @@ -407,7 +402,7 @@ func printObject( // printResourceOutputProperties prints only those properties that either differ from the input properties or, if // there is an old snapshot of the resource, differ from the prior old snapshot's output properties. func printResourceOutputProperties(b *bytes.Buffer, step deploy.Step, - seen map[resource.URN]deploy.Step, shown map[resource.URN]bool, planning bool, debug bool) { + seen map[resource.URN]deploy.Step, planning bool, debug bool) { // Only certain kinds of steps have output properties associated with them. new := step.New() if new == nil || new.Outputs == nil { @@ -416,7 +411,7 @@ func printResourceOutputProperties(b *bytes.Buffer, step deploy.Step, op := considerSameIfNotCreateOrDelete(step.Op()) // Now compute the indentation level, in part based on the parents. - indent := stepParentIndent(b, step, seen, shown, false, 0, false, debug) + indent := stepParentIndent(b, step, seen, false, 0, false, debug) // First fetch all the relevant property maps that we may consult. ins := new.Inputs diff --git a/pkg/engine/preview.go b/pkg/engine/preview.go index 692fd14b2..a6e7850d7 100644 --- a/pkg/engine/preview.go +++ b/pkg/engine/preview.go @@ -65,18 +65,16 @@ func previewLatest(info *planContext, opts deployOptions) error { } type previewActions struct { - Ops map[deploy.StepOp]int - Opts deployOptions - Seen map[resource.URN]deploy.Step - Shown map[resource.URN]bool + Ops map[deploy.StepOp]int + Opts deployOptions + Seen map[resource.URN]deploy.Step } func newPreviewActions(opts deployOptions) *previewActions { return &previewActions{ - Ops: make(map[deploy.StepOp]int), - Opts: opts, - Seen: make(map[resource.URN]deploy.Step), - Shown: make(map[resource.URN]bool), + Ops: make(map[deploy.StepOp]int), + Opts: opts, + Seen: make(map[resource.URN]deploy.Step), } } @@ -87,7 +85,7 @@ func (acts *previewActions) OnResourceStepPre(step deploy.Step) (interface{}, er if shouldShow(acts.Seen, step, acts.Opts) || isRootStack(step) { var b bytes.Buffer printStep(&b, step, - acts.Seen, acts.Shown, acts.Opts.Summary, true, 0 /*indent*/, acts.Opts.Debug) + acts.Seen, acts.Opts.Summary, true, 0 /*indent*/, acts.Opts.Debug) acts.Opts.Events <- stdOutEventWithColor(&b) } return nil, nil @@ -118,7 +116,7 @@ func (acts *previewActions) OnResourceOutputs(step deploy.Step) error { // Print this step's output properties. if (shouldShow(acts.Seen, step, acts.Opts) || isRootStack(step)) && !acts.Opts.Summary { var b bytes.Buffer - printResourceOutputProperties(&b, step, acts.Seen, acts.Shown, true, acts.Opts.Debug) + printResourceOutputProperties(&b, step, acts.Seen, true, acts.Opts.Debug) acts.Opts.Events <- stdOutEventWithColor(&b) } return nil