From 0c3277476cfc3921b455bc11d3473f64be509b6c Mon Sep 17 00:00:00 2001 From: Yissachar Radcliffe Date: Tue, 6 Sep 2016 11:45:46 -0400 Subject: [PATCH] Show the details of what resources will be created --- upup/pkg/fi/dryrun_target.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/upup/pkg/fi/dryrun_target.go b/upup/pkg/fi/dryrun_target.go index 40b6187549580..2fbb0cb5dccbc 100644 --- a/upup/pkg/fi/dryrun_target.go +++ b/upup/pkg/fi/dryrun_target.go @@ -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 != "" && fieldValue != "id:" && fieldValue != "" { + fmt.Fprintf(b, " \t%s\t%s\n", fieldName, fieldValue) + } + } + } } }