Skip to content

Commit 51ee838

Browse files
Merge pull request openshift#8058 from hamzy/PowerVS-debug-ServiceInstanceNameToGUID
OCPBUGS-29895: PowerVS: Add debugging to ServiceInstanceNameToGUID
2 parents 9978285 + 11d4ab8 commit 51ee838

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

pkg/destroy/powervs/powervs.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,17 +710,20 @@ func (o *ClusterUninstaller) ServiceInstanceNameToGUID(ctx context.Context, name
710710
groupID = o.resourceGroupID
711711
)
712712

713+
o.Logger.Debugf("ServiceInstanceNameToGUID: groupID = %s", groupID)
713714
// If the user passes in a human readable group id, then we need to convert it to a UUID
714715
listGroupOptions := o.managementSvc.NewListResourceGroupsOptions()
715716
groups, _, err := o.managementSvc.ListResourceGroupsWithContext(ctx, listGroupOptions)
716717
if err != nil {
717718
return "", fmt.Errorf("failed to list resource groups: %w", err)
718719
}
719720
for _, group := range groups.Resources {
721+
o.Logger.Debugf("ServiceInstanceNameToGUID: group.Name = %s", *group.Name)
720722
if *group.Name == groupID {
721723
groupID = *group.ID
722724
}
723725
}
726+
o.Logger.Debugf("ServiceInstanceNameToGUID: groupID = %s", groupID)
724727

725728
options = o.controllerSvc.NewListResourceInstancesOptions()
726729
options.SetResourceGroupID(groupID)
@@ -741,6 +744,8 @@ func (o *ClusterUninstaller) ServiceInstanceNameToGUID(ctx context.Context, name
741744
response *core.DetailedResponse
742745
)
743746

747+
o.Logger.Debugf("ServiceInstanceNameToGUID: resource.Name = %s", *resource.Name)
748+
744749
getResourceOptions = o.controllerSvc.NewGetResourceInstanceOptions(*resource.ID)
745750

746751
resourceInstance, response, err = o.controllerSvc.GetResourceInstance(getResourceOptions)
@@ -751,7 +756,13 @@ func (o *ClusterUninstaller) ServiceInstanceNameToGUID(ctx context.Context, name
751756
return "", fmt.Errorf("failed to get instance, response is: %v", response)
752757
}
753758

754-
if resourceInstance.Type == nil || resourceInstance.GUID == nil {
759+
if resourceInstance.Type == nil {
760+
o.Logger.Debugf("ServiceInstanceNameToGUID: type: nil")
761+
continue
762+
}
763+
o.Logger.Debugf("ServiceInstanceNameToGUID: type: %v", *resourceInstance.Type)
764+
if resourceInstance.GUID == nil {
765+
o.Logger.Debugf("ServiceInstanceNameToGUID: GUID: nil")
755766
continue
756767
}
757768
if *resourceInstance.Type != "service_instance" && *resourceInstance.Type != "composite_instance" {
@@ -760,6 +771,9 @@ func (o *ClusterUninstaller) ServiceInstanceNameToGUID(ctx context.Context, name
760771
if *resourceInstance.Name != name {
761772
continue
762773
}
774+
775+
o.Logger.Debugf("ServiceInstanceNameToGUID: Found match!")
776+
763777
return *resourceInstance.GUID, nil
764778
}
765779

0 commit comments

Comments
 (0)