1
0
mirror of https://github.com/rancher/norman.git synced 2025-09-24 20:48:18 +00:00

Get name/namespace from metadata/name,namespace not name,namespaceId

This commit is contained in:
Darren Shepherd
2018-06-19 11:24:23 -07:00
parent 0d782dfe15
commit 0e3bc2dfca

View File

@@ -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)