fixed coalesceListsFullKey

Signed-off-by: Suleiman Dibirov <idsulik@gmail.com>
pull/12791/head
Suleiman Dibirov 1 year ago
parent 6057585fa4
commit 12a1ec7348

@ -19,7 +19,6 @@ package chartutil
import ( import (
"fmt" "fmt"
"log" "log"
"strconv"
"github.com/mitchellh/copystructure" "github.com/mitchellh/copystructure"
"github.com/pkg/errors" "github.com/pkg/errors"
@ -317,7 +316,11 @@ func coalesceListsFullKey(printf printFn, dst, src []interface{}, prefix string,
dst = append(dst, val) dst = append(dst, val)
} else if dst[key] == nil { } else if dst[key] == nil {
dst[key] = val dst[key] = val
} else if istable(val) && istable(dst[key]) { } else if istable(val) {
if !istable(dst[key]) {
fullkey := concatPrefix(prefix, fmt.Sprintf("%v", key))
printf("warning: cannot overwrite table with non table for %s (%v)", fullkey, val)
}
dst[key] = coalesceTablesFullKey( dst[key] = coalesceTablesFullKey(
printf, printf,
dst[key].(map[string]interface{}), dst[key].(map[string]interface{}),
@ -325,9 +328,20 @@ func coalesceListsFullKey(printf printFn, dst, src []interface{}, prefix string,
prefix, prefix,
merge, merge,
) )
} else if islist(val) {
if !islist(dst[key]) {
fullkey := concatPrefix(prefix, fmt.Sprintf("%v", key))
printf("warning: cannot overwrite list with non list for %s (%v)", fullkey, val)
}
dst[key] = coalesceListsFullKey(
printf,
dst[key].([]interface{}),
val.([]interface{}),
prefix,
merge,
)
} else { } else {
fullkey := concatPrefix(prefix, strconv.Itoa(key)) dst[key] = val
printf("warning: cannot overwrite table with non table for %s (%v)", fullkey, val)
} }
} }
return dst return dst

Loading…
Cancel
Save