1
0
mirror of https://github.com/rancher/types.git synced 2025-09-02 05:35:16 +00:00

fix namespace_reference mapper on update handler

This commit is contained in:
gitlawr
2018-09-11 18:51:44 +08:00
committed by Alena Prokharchyk
parent 30c4b554a2
commit 6a993793e3
2 changed files with 2 additions and 5 deletions

View File

@@ -32,13 +32,10 @@ func (n *NamespaceReference) FromInternal(data map[string]interface{}) {
func (n *NamespaceReference) ToInternal(data map[string]interface{}) error {
namespaceID, ok := data["namespaceId"]
if !ok {
return nil
}
for _, path := range n.fields {
convert.Transform(data, path, func(input interface{}) interface{} {
parts := strings.SplitN(convert.ToString(input), ":", 2)
if len(parts) == 2 && (parts[0] == namespaceID) {
if len(parts) == 2 && (!ok || parts[0] == namespaceID) {
return parts[1]
}
return input