From 0e3bc2dfcadef2ad5da344d2eb92dc7212a2ff82 Mon Sep 17 00:00:00 2001 From: Darren Shepherd Date: Tue, 19 Jun 2018 11:24:23 -0700 Subject: [PATCH] Get name/namespace from metadata/name,namespace not name,namespaceId --- types/mapper.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/types/mapper.go b/types/mapper.go index 68b22b87..d6a16bed 100644 --- a/types/mapper.go +++ b/types/mapper.go @@ -5,6 +5,7 @@ import ( "github.com/rancher/norman/types/convert" "github.com/rancher/norman/types/definition" + "github.com/rancher/norman/types/values" ) type Mapper interface { @@ -45,6 +46,9 @@ type typeMapper struct { } func (t *typeMapper) FromInternal(data map[string]interface{}) { + name, _ := values.GetValueN(data, "metadata", "name").(string) + namespace, _ := values.GetValueN(data, "metadata", "namespace").(string) + for fieldName, schema := range t.subSchemas { if schema.Mapper == nil { continue @@ -71,9 +75,6 @@ func (t *typeMapper) FromInternal(data map[string]interface{}) { } if data != nil && t.root { - name, _ := data["name"].(string) - namespace, _ := data["namespaceId"].(string) - if _, ok := data["id"]; ok { if namespace != "" { id, _ := data["id"].(string)