Print step op labels

This commit is contained in:
joeduffy 2017-02-24 17:44:54 -08:00
parent b43c374905
commit e0440ad312
2 changed files with 8 additions and 8 deletions

View file

@ -348,7 +348,7 @@ func (prog *applyProgress) Before(step resource.Step) {
// Print the step. // Print the step.
var b bytes.Buffer var b bytes.Buffer
stepnum := prog.Steps + 1 stepnum := prog.Steps + 1
b.WriteString(fmt.Sprintf("Applying step #%v\n", stepnum)) b.WriteString(fmt.Sprintf("Applying step #%v [%v]\n", stepnum, step.Op()))
printStep(&b, step, !prog.Detail, " ") printStep(&b, step, !prog.Detail, " ")
s := colors.Colorize(b.String()) s := colors.Colorize(b.String())
fmt.Printf(s) fmt.Printf(s)
@ -363,7 +363,7 @@ func (prog *applyProgress) After(step resource.Step, err error, state resource.R
var b bytes.Buffer var b bytes.Buffer
// Print the state of the resource; we don't issue the error, because the apply above will do that. // Print the state of the resource; we don't issue the error, because the apply above will do that.
stepnum := prog.Steps + 1 stepnum := prog.Steps + 1
b.WriteString(fmt.Sprintf("Step #%v failed: ", stepnum)) b.WriteString(fmt.Sprintf("Step #%v failed [%v]: ", stepnum, step.Op()))
switch state { switch state {
case resource.StateOK: case resource.StateOK:
b.WriteString(colors.SpecNote) b.WriteString(colors.SpecNote)
@ -465,7 +465,7 @@ func printResourceProperties(b *bytes.Buffer, old resource.Resource, new resourc
if id != "" { if id != "" {
b.WriteString(fmt.Sprintf("%s[id=%s]\n", indent, string(id))) b.WriteString(fmt.Sprintf("%s[id=%s]\n", indent, string(id)))
} }
b.WriteString(fmt.Sprintf("%s[m=%s]\n", indent, string(moniker))) b.WriteString(fmt.Sprintf("%s[mk=%s]\n", indent, string(moniker)))
if details { if details {
// Print all of the properties associated with this resource. // Print all of the properties associated with this resource.

View file

@ -38,13 +38,13 @@ type Step interface {
} }
// StepOp represents the kind of operation performed by this step. // StepOp represents the kind of operation performed by this step.
type StepOp int type StepOp string
const ( const (
OpCreate StepOp = iota OpCreate StepOp = "create"
OpRead OpRead = "read"
OpUpdate OpUpdate = "update"
OpDelete OpDelete = "delete"
) )
// NewCreatePlan creates a plan for instantiating a new snapshot from scratch. // NewCreatePlan creates a plan for instantiating a new snapshot from scratch.