Skip to content

Commit

Permalink
Merge pull request #65 from xueli181114/OCM-9533
Browse files Browse the repository at this point in the history
OCM-9533 | test: Update the ami name for proxy launching due to the change on AWS
  • Loading branch information
ciaranRoche authored Jul 11, 2024
2 parents 5504383 + 8ffc9ce commit 4c98682
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
7 changes: 1 addition & 6 deletions pkg/aws/aws_client/key_pair.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"

"github.com/aws/aws-sdk-go-v2/service/ec2"
"github.com/openshift-online/ocm-common/pkg/log"
)

func (client *AWSClient) CreateKeyPair(keyName string) (*ec2.CreateKeyPairOutput, error) {
Expand All @@ -15,11 +14,8 @@ func (client *AWSClient) CreateKeyPair(keyName string) (*ec2.CreateKeyPairOutput

output, err := client.Ec2Client.CreateKeyPair(context.TODO(), input)
if err != nil {
log.LogError("Create key pair error " + err.Error())
return nil, err
}
log.LogInfo("Create key pair success: " + *output.KeyPairId)

return output, err
}

Expand All @@ -30,10 +26,9 @@ func (client *AWSClient) DeleteKeyPair(keyName string) (*ec2.DeleteKeyPairOutput

output, err := client.Ec2Client.DeleteKeyPair(context.TODO(), input)
if err != nil {
log.LogError("Delete key pair error " + err.Error())

return nil, err
}
log.LogInfo("Delete key pair success")
return output, err

}
2 changes: 1 addition & 1 deletion pkg/aws/consts/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const (
BastionName = "ocm-bastion"
)

var PublicImageName = "al2023-ami-2023.4.20240416.0-kernel-6.1-x86_64"
var PublicImageName = "al2023-ami-2023.5.20240708.0-kernel-6.1-x86_64"

var BastionImageMap = map[string]string{
"us-east-1": "ami-01c647eace872fc02",
Expand Down
6 changes: 4 additions & 2 deletions pkg/test/vpc_client/key_pair.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import (
func (vpc *VPC) CreateKeyPair(keyName string) (*ec2.CreateKeyPairOutput, error) {
output, err := vpc.AWSClient.CreateKeyPair(keyName)
if err != nil {
log.LogError("Create key pair meets error %s", err.Error())
return nil, err
}
log.LogInfo("create key pair: %v successfully\n", *output.KeyPairId)
log.LogInfo("Create key pair %v successfully\n", *output.KeyPairId)

return output, nil
}
Expand All @@ -19,9 +20,10 @@ func (vpc *VPC) DeleteKeyPair(keyNames []string) error {
for _, key := range keyNames {
_, err := vpc.AWSClient.DeleteKeyPair(key)
if err != nil {
log.LogError("Delete key pair meets error %s", err.Error())
return err
}
}
log.LogInfo("delete key pair successfully\n")
log.LogInfo("Delete key pair successfully")
return nil
}

0 comments on commit 4c98682

Please sign in to comment.