Skip to content

Commit 4548be2

Browse files
committed
OCPBUGS-56658: When AWS_PROFILE is invalid ask for credentials
** The credentials changed in AWS SDK V2. When the AWS_PROFILE environment variable was set to an invalid value the install would not proceed through the failure. The inention was to ask for the aws key and id information. Now the information will be added to the survey, and the information will be added to the config in .aws.
1 parent 7b227fa commit 4548be2

File tree

1 file changed

+5
-5
lines changed
  • pkg/asset/installconfig/aws

1 file changed

+5
-5
lines changed

pkg/asset/installconfig/aws/ec2.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@ func GetRegions(ctx context.Context) ([]string, error) {
2020
// the DescribeRegions call will fail immediately.
2121
cfg, err := cfgv2.LoadDefaultConfig(ctx, cfgv2.WithRegion("us-east-1"))
2222
if err != nil {
23-
return nil, fmt.Errorf("failed to create config from platform: %w", err)
24-
}
25-
26-
if _, err = cfg.Credentials.Retrieve(ctx); err != nil {
2723
logrus.Debugf("failed to retrieve AWS credentials: %v", err)
2824
if err = getUserCredentials(); err != nil {
2925
return nil, err
3026
}
3127
cfg, err = cfgv2.LoadDefaultConfig(ctx, cfgv2.WithRegion("us-east-1"))
3228
if err != nil {
33-
return nil, fmt.Errorf("failed to create config from platform: %w", err)
29+
return nil, fmt.Errorf("failed to create AWS config: %w", err)
3430
}
3531
}
32+
33+
if _, err = cfg.Credentials.Retrieve(ctx); err != nil {
34+
return nil, fmt.Errorf("failed to retrieve AWS credentials: %w", err)
35+
}
3636
client := ec2v2.NewFromConfig(cfg)
3737

3838
output, err := client.DescribeRegions(ctx, &ec2v2.DescribeRegionsInput{AllRegions: aws.Bool(true)})

0 commit comments

Comments
 (0)