1
0
mirror of https://github.com/rancher/norman.git synced 2025-09-01 23:36:58 +00:00

Breakout merge that allows changing metadata and status

This commit is contained in:
Darren Shepherd
2018-10-04 14:08:16 -07:00
parent 217609a71c
commit d5ff49f613

View File

@@ -9,7 +9,7 @@ import (
) )
func APIUpdateMerge(schema *types.Schema, schemas *types.Schemas, dest, src map[string]interface{}, replace bool) map[string]interface{} { func APIUpdateMerge(schema *types.Schema, schemas *types.Schemas, dest, src map[string]interface{}, replace bool) map[string]interface{} {
result := mergeMaps("", nil, schema, schemas, replace, dest, src) result := UpdateMerge(schema, schemas, dest, src, replace)
if s, ok := dest["status"]; ok { if s, ok := dest["status"]; ok {
result["status"] = s result["status"] = s
} }
@@ -19,6 +19,10 @@ func APIUpdateMerge(schema *types.Schema, schemas *types.Schemas, dest, src map[
return result return result
} }
func UpdateMerge(schema *types.Schema, schemas *types.Schemas, dest, src map[string]interface{}, replace bool) map[string]interface{} {
return mergeMaps("", nil, schema, schemas, replace, dest, src)
}
func isProtected(k string) bool { func isProtected(k string) bool {
if !strings.Contains(k, "cattle.io/") || (isField(k) && k != "field.cattle.io/creatorId") { if !strings.Contains(k, "cattle.io/") || (isField(k) && k != "field.cattle.io/creatorId") {
return false return false