metadata: Fix parsing of JSON

`ok` was not assigned when type casting to `map[string]interface{}` so the
subsequent check was testing a stale value.

Also, the error message upon failure had the wrong sense.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
This commit is contained in:
Ian Campbell 2017-05-09 23:40:27 +01:00
parent e0bcac3a28
commit 8fd1a3cbdb

View File

@ -167,9 +167,9 @@ func processUserData(data []byte) error {
continue continue
} }
for f, i := range files { for f, i := range files {
fi := i.(map[string]interface{}) fi, ok := i.(map[string]interface{})
if !ok { if !ok {
log.Printf("Could convert JSON for items: %s", i) log.Printf("Couldn't convert JSON for items: %s", i)
continue continue
} }
if _, ok := fi["perm"]; !ok { if _, ok := fi["perm"]; !ok {