Skip to content

Commit

Permalink
Merge pull request #15617 from svanharmelen/b-chef-provisioner
Browse files Browse the repository at this point in the history
provisioner/chef: fix panic
  • Loading branch information
grubernaut authored Jul 24, 2017
2 parents fc3782f + b01f68f commit f98cfc9
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions builtin/provisioners/chef/resource_provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -782,18 +782,18 @@ func decodeConfig(d *schema.ResourceData) (*provisioner, error) {
}

func getStringList(v interface{}) []string {
if v == nil {
return nil
}
switch l := v.(type) {
case []string:
return l
var result []string

switch v := v.(type) {
case nil:
return result
case []interface{}:
arr := make([]string, len(l))
for i, x := range l {
arr[i] = x.(string)
for _, vv := range v {
if vv, ok := vv.(string); ok {
result = append(result, vv)
}
}
return arr
return result
default:
panic(fmt.Sprintf("Unsupported type: %T", v))
}
Expand Down

0 comments on commit f98cfc9

Please sign in to comment.