ignore empty json fields when processing templates

This commit is contained in:
Cory Bennett
2016-08-02 22:36:51 -07:00
parent 469def0296
commit f5f3e28b23
+9
View File
@@ -322,6 +322,9 @@ func yamlFixup(data interface{}) (interface{}, error) {
return nil, err
}
}
if len(copy) == 0 {
return nil, nil
}
return copy, nil
case map[string]interface{}:
copy := make(map[string]interface{})
@@ -332,6 +335,9 @@ func yamlFixup(data interface{}) (interface{}, error) {
copy[k] = fixed
}
}
if len(copy) == 0 {
return nil, nil
}
return copy, nil
case []interface{}:
copy := make([]interface{}, 0, len(d))
@@ -342,6 +348,9 @@ func yamlFixup(data interface{}) (interface{}, error) {
copy = append(copy, fixed)
}
}
if len(copy) == 0 {
return nil, nil
}
return copy, nil
case string:
if d == "" || d == "\n" {