mirror of
https://github.com/helm/helm.git
synced 2026-08-07 08:31:21 +00:00
fix(chartutil): fix Table() method to test Values
This makes the Table() method more flexible than the original version.
It allows either a map[string]interface{} or a chartutil.Values to be
treated as a table.
This commit is contained in:
@@ -94,12 +94,18 @@ func tableLookup(v Values, simple string) (Values, error) {
|
||||
if !ok {
|
||||
return v, ErrNoTable
|
||||
}
|
||||
//vv, ok := v2.(map[string]interface{})
|
||||
vv, ok := v2.(Values)
|
||||
if !ok {
|
||||
return vv, ErrNoTable
|
||||
if vv, ok := v2.(map[string]interface{}); ok {
|
||||
return vv, nil
|
||||
}
|
||||
return vv, nil
|
||||
|
||||
// This catches a case where a value is of type Values, but doesn't (for some
|
||||
// reason) match the map[string]interface{}. This has been observed in the
|
||||
// wild, and might be a result of a nil map of type Values.
|
||||
if vv, ok := v2.(Values); ok {
|
||||
return vv, nil
|
||||
}
|
||||
|
||||
return map[string]interface{}{}, ErrNoTable
|
||||
}
|
||||
|
||||
// ReadValues will parse YAML byte data into a Values.
|
||||
|
||||
Reference in New Issue
Block a user