Skip to content

Commit

Permalink
Select the default resource group for the account while creating the …
Browse files Browse the repository at this point in the history
…IBM COS
  • Loading branch information
mkumatag committed Dec 10, 2020
1 parent eabda78 commit 2d54a8b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cmd/image/upload/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ pvsadm image upload --bucket basheerbucket1320 -o centos-8-latest.ova.gz --regio
}

func init() {
Cmd.Flags().StringVar(&pkg.ImageCMDOptions.ResourceGrp, "resource-group", "default", "Provide Resource-Group")
Cmd.Flags().StringVar(&pkg.ImageCMDOptions.ResourceGrp, "resource-group", "", "Provide Resource-Group(default: default resource group set for the account")
Cmd.Flags().StringVar(&pkg.ImageCMDOptions.ServicePlan, "service-plan", "standard", "Provide serviceplan type")
Cmd.Flags().StringVarP(&pkg.ImageCMDOptions.InstanceName, "instance-name", "n", "", "Instance Name of the COS to be used")
Cmd.Flags().StringVarP(&pkg.ImageCMDOptions.BucketName, "bucket", "b", "", "Region of the COS instance")
Expand Down
9 changes: 5 additions & 4 deletions pkg/client/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func CreateServiceInstance(sess *session.Session, instanceName, serviceName, ser
return "", err
}

var resourceGroupID string
var resourceGroup models.ResourceGroup
resGrpAPI := managementClient.ResourceGroup()

if resourceGrp == "" {
Expand All @@ -84,15 +84,16 @@ func CreateServiceInstance(sess *session.Session, instanceName, serviceName, ser
if err != nil {
return "", err
}
resourceGroupID = grpList[0].ID
resourceGroup = grpList[0]

} else {
grp, err := resGrpAPI.FindByName(nil, resourceGrp)
if err != nil {
return "", err
}
resourceGroupID = grp[0].ID
resourceGroup = grp[0]
}
klog.Infof("Resource group: %s and ID: %s", resourceGroup.Name, resourceGroup.ID)

controllerClient, err := controller.New(sess)
if err != nil {
Expand All @@ -104,7 +105,7 @@ func CreateServiceInstance(sess *session.Session, instanceName, serviceName, ser
var serviceInstancePayload = controller.CreateServiceInstanceRequest{
Name: instanceName,
ServicePlanID: servicePlanID,
ResourceGroupID: resourceGroupID,
ResourceGroupID: resourceGroup.ID,
TargetCrn: supportedDeployments[0].CatalogCRN,
}

Expand Down

0 comments on commit 2d54a8b

Please sign in to comment.