diff --git a/pkg/chart/v2/util/coalesce.go b/pkg/chart/v2/util/coalesce.go index d5d163c5e..307603bae 100644 --- a/pkg/chart/v2/util/coalesce.go +++ b/pkg/chart/v2/util/coalesce.go @@ -300,7 +300,7 @@ func coalesceTablesFullKey(printf printFn, dst, src map[string]interface{}, pref } else { printf("warning: cannot overwrite table with non table for %s (%v)", fullkey, val) } - } else if istable(dv) && val != nil && val != "" && len(dv.(map[string]interface{})) > 0 { + } else if istable(dv) && val != nil && isNonEmptyString(val) && isNonEmptyTable(dv) { printf("warning: destination for %s is a table. Ignoring non-table value (%v)", fullkey, val) } } diff --git a/pkg/chart/v2/util/values.go b/pkg/chart/v2/util/values.go index 6850e8b9b..5dbc2a3a3 100644 --- a/pkg/chart/v2/util/values.go +++ b/pkg/chart/v2/util/values.go @@ -179,6 +179,24 @@ func istable(v interface{}) bool { return ok } +func isNonEmptyTable(val interface{}) bool { + table, ok := val.(map[string]interface{}) + if !ok { + return false + } + + return len(table) > 0 +} + +func isNonEmptyString(val interface{}) bool { + stringContent, ok := val.(string) + if !ok { + return false + } + + return stringContent != "" +} + // PathValue takes a path that traverses a YAML structure and returns the value at the end of that path. // The path starts at the root of the YAML structure and is comprised of YAML keys separated by periods. // Given the following YAML data the value at path "chapter.one.title" is "Loomings".