From 23b736dccbd5ba9dd4925f0e0c5faf92a35a73dc Mon Sep 17 00:00:00 2001 From: Jingfang Liu Date: Wed, 27 Jan 2021 10:37:11 -0800 Subject: [PATCH] update functions for wrapping an inventory ResourceGroup (#1391) --- commands/migratecmd.go | 2 +- pkg/live/inventoryrg.go | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/commands/migratecmd.go b/commands/migratecmd.go index 37b8f368d0..5dcf834695 100644 --- a/commands/migratecmd.go +++ b/commands/migratecmd.go @@ -262,7 +262,7 @@ func (mr *MigrateRunner) migrateObjs(cmObjs []object.ObjMetadata, oldID string, if err != nil { return err } - inv := live.WrapInventoryInfoObj(rgInv) + inv := live.WrapInventoryResourceGroup(rgInv) err = updateOwningInventoryAnnotation(mr.rgProvider.Factory(), cmObjs, oldID, inv.ID()) if err != nil { return err diff --git a/pkg/live/inventoryrg.go b/pkg/live/inventoryrg.go index 8ef746c40c..97361e7624 100644 --- a/pkg/live/inventoryrg.go +++ b/pkg/live/inventoryrg.go @@ -49,17 +49,16 @@ type InventoryResourceGroup struct { var _ inventory.Inventory = &InventoryResourceGroup{} var _ inventory.InventoryInfo = &InventoryResourceGroup{} -// WrapInventoryObj takes a passed ResourceGroup (as a resource.Info), +// WrapInventoryObj takes a passed ResourceGroup (as an unstructured), // wraps it with the InventoryResourceGroup and upcasts the wrapper as // an the Inventory interface. func WrapInventoryObj(obj *unstructured.Unstructured) inventory.Inventory { - if obj != nil { - klog.V(4).Infof("wrapping Inventory obj: %s/%s\n", obj.GetNamespace(), obj.GetName()) - } - return &InventoryResourceGroup{inv: obj} + return WrapInventoryResourceGroup(obj) } -func WrapInventoryInfoObj(obj *unstructured.Unstructured) inventory.InventoryInfo { +// WrapInventoryResourceGroup takes a passed ResourceGroup (as an unstructured), +// wraps it with the InventoryResourceGroup. +func WrapInventoryResourceGroup(obj *unstructured.Unstructured) *InventoryResourceGroup { if obj != nil { klog.V(4).Infof("wrapping InventoryInfo obj: %s/%s\n", obj.GetNamespace(), obj.GetName()) }