Merge pull request #446 from yissachar/show-resource-creation-details

Show the details of what resources will be created
This commit is contained in:
Justin Santa Barbara 2016-09-17 15:05:47 -04:00 committed by GitHub
commit c7c892c38a
1 changed files with 21 additions and 0 deletions

View File

@ -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)
}
}
}
}
}