Skip to content

Commit 8b207d8

Browse files
Merge pull request #8111 from miyamotoh/enable-deploy-by-service-id
OCPBUGS-30641: Enable deploy by Service ID on PowerVS
2 parents 5f86562 + 907cf72 commit 8b207d8

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

pkg/asset/installconfig/powervs/client.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,7 @@ func (c *Client) GetVPCs(ctx context.Context, region string) ([]vpcv1.VPC, error
595595
// ListResourceGroups returns a list of resource groups.
596596
func (c *Client) ListResourceGroups(ctx context.Context) (*resourcemanagerv2.ResourceGroupList, error) {
597597
listResourceGroupsOptions := c.managementAPI.NewListResourceGroupsOptions()
598+
listResourceGroupsOptions.AccountID = &c.BXCli.User.Account
598599

599600
resourceGroups, _, err := c.managementAPI.ListResourceGroups(listResourceGroupsOptions)
600601
if err != nil {
@@ -624,6 +625,7 @@ func (c *Client) ListServiceInstances(ctx context.Context) ([]string, error) {
624625

625626
// If the user passes in a human readable group id, then we need to convert it to a UUID
626627
listGroupOptions := c.managementAPI.NewListResourceGroupsOptions()
628+
listGroupOptions.AccountID = &c.BXCli.User.Account
627629
groups, _, err := c.managementAPI.ListResourceGroupsWithContext(ctx, listGroupOptions)
628630
if err != nil {
629631
return nil, fmt.Errorf("failed to list resource groups: %w", err)
@@ -699,6 +701,7 @@ func (c *Client) ServiceInstanceGUIDToName(ctx context.Context, id string) (stri
699701

700702
// If the user passes in a human readable group id, then we need to convert it to a UUID
701703
listGroupOptions := c.managementAPI.NewListResourceGroupsOptions()
704+
listGroupOptions.AccountID = &c.BXCli.User.Account
702705
groups, _, err := c.managementAPI.ListResourceGroupsWithContext(ctx, listGroupOptions)
703706
if err != nil {
704707
return "", fmt.Errorf("failed to list resource groups: %w", err)

pkg/asset/installconfig/powervs/metadata.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,10 @@ func (m *Metadata) AccountID(ctx context.Context) (string, error) {
5656
}
5757

5858
if m.accountID == "" {
59-
apiKeyDetails, err := m.client.GetAuthenticatorAPIKeyDetails(ctx)
60-
if err != nil {
61-
return "", err
59+
if m.client.BXCli.User == nil || m.client.BXCli.User.Account == "" {
60+
return "", fmt.Errorf("failed to get find account ID: %+v", m.client.BXCli.User)
6261
}
63-
64-
m.accountID = *apiKeyDetails.AccountID
62+
m.accountID = m.client.BXCli.User.Account
6563
}
6664

6765
return m.accountID, nil

0 commit comments

Comments
 (0)