Skip to content

Commit

Permalink
Merge pull request #446 from yissachar/show-resource-creation-details
Browse files Browse the repository at this point in the history
Show the details of what resources will be created
  • Loading branch information
justinsb authored Sep 17, 2016
2 parents ce4b3ef + 0c32774 commit c7c892c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions upup/pkg/fi/dryrun_target.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,27 @@ func (t *DryRunTarget) PrintReport(taskMap map[string]Task, out io.Writer) error
for _, r := range creates {
taskName := getTaskName(r.changes)
fmt.Fprintf(b, " %s\t%s\n", taskName, IdForTask(taskMap, r.e))

changes := reflect.ValueOf(r.changes)
if changes.Kind() == reflect.Ptr && !changes.IsNil() {
changes = changes.Elem()
}

if changes.Kind() == reflect.Struct {
for i := 0; i < changes.NumField(); i++ {

field := changes.Field(i)

fieldName := changes.Type().Field(i).Name
fieldValue := ValueAsString(field)

// The field name is already printed above, no need to repeat it.
// Additionally, ignore any output that is not informative
if fieldName != "Name" && fieldValue != "<nil>" && fieldValue != "id:<nil>" && fieldValue != "<resource>" {
fmt.Fprintf(b, " \t%s\t%s\n", fieldName, fieldValue)
}
}
}
}
}

Expand Down

0 comments on commit c7c892c

Please sign in to comment.