Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCM-9533 | test: Update the ami name for proxy launching due to the change on AWS #65

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
Loading