Skip to content

Commit

Permalink
update functions for wrapping an inventory ResourceGroup (#1391)
Browse files Browse the repository at this point in the history
  • Loading branch information
Liujingfang1 committed Jan 27, 2021
1 parent 0a309ca commit 23b736d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion commands/migratecmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 5 additions & 6 deletions pkg/live/inventoryrg.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down

0 comments on commit 23b736d

Please sign in to comment.