diff --git a/pkg/aws/aws_client/key_pair.go b/pkg/aws/aws_client/key_pair.go index 41ae26a3..1e1935e2 100644 --- a/pkg/aws/aws_client/key_pair.go +++ b/pkg/aws/aws_client/key_pair.go @@ -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) { @@ -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 } @@ -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 } diff --git a/pkg/aws/consts/consts.go b/pkg/aws/consts/consts.go index b0fbd2ea..2118c225 100644 --- a/pkg/aws/consts/consts.go +++ b/pkg/aws/consts/consts.go @@ -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", diff --git a/pkg/test/vpc_client/key_pair.go b/pkg/test/vpc_client/key_pair.go index abb9b81c..c4523144 100644 --- a/pkg/test/vpc_client/key_pair.go +++ b/pkg/test/vpc_client/key_pair.go @@ -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 } @@ -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 }