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:
committed by
Alena Prokharchyk
parent
30c4b554a2
commit
6a993793e3
@@ -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
|
||||
|
Reference in New Issue
Block a user