From 3080965eda23f6a4dcf0c200099b8768a247a18a Mon Sep 17 00:00:00 2001 From: Stuart Hendren Date: Wed, 6 May 2015 12:21:17 +0100 Subject: [PATCH] JCLOUDS-207: Key Pair and Security Groups created by jclouds are not removed when the node is destroyed The names created do not match those searched for. They are created in FormatSharedNamesAndAppendUniqueStringToThoseWhichRepeat.java and have are of this form jclouds#I-0#e96. But for example jclouds#I-0#us-east-1#* is used as the search term. --- .../main/java/org/jclouds/ec2/compute/EC2ComputeService.java | 2 +- .../aws/ec2/compute/AWSEC2ComputeServiceApiMockTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/compute/EC2ComputeService.java b/apis/ec2/src/main/java/org/jclouds/ec2/compute/EC2ComputeService.java index 16019cbbfa..88fe5f6403 100644 --- a/apis/ec2/src/main/java/org/jclouds/ec2/compute/EC2ComputeService.java +++ b/apis/ec2/src/main/java/org/jclouds/ec2/compute/EC2ComputeService.java @@ -235,7 +235,7 @@ public class EC2ComputeService extends BaseComputeService { for (KeyPair keyPair : client.getKeyPairApi().get().describeKeyPairsInRegionWithFilter(region, ImmutableMultimap.builder() .put("key-name", Strings2.urlEncode( - String.format("jclouds#%s#%s*", group, region).replace('#', delimiter))) + String.format("jclouds#%s#*", group).replace('#', delimiter))) .build())) { String keyName = keyPair.getKeyName(); Predicate keyNameMatcher = namingConvention.create().containsGroup(group); diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2ComputeServiceApiMockTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2ComputeServiceApiMockTest.java index 3d6dcf0e7f..2a897957e0 100644 --- a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2ComputeServiceApiMockTest.java +++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2ComputeServiceApiMockTest.java @@ -253,7 +253,7 @@ public class AWSEC2ComputeServiceApiMockTest extends BaseAWSEC2ApiMockTest { assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); assertPosted(DEFAULT_REGION, "Action=DescribeSecurityGroups&GroupName.1=jclouds%23sg-3c6ef654"); assertPosted(DEFAULT_REGION, "Action=DeleteSecurityGroup&GroupName=jclouds%23sg-3c6ef654"); - assertPosted(DEFAULT_REGION, "Action=DescribeKeyPairs&Filter.1.Name=key-name&Filter.1.Value.1=jclouds%23sg-3c6ef654%23us-east-1%2A"); + assertPosted(DEFAULT_REGION, "Action=DescribeKeyPairs&Filter.1.Name=key-name&Filter.1.Value.1=jclouds%23sg-3c6ef654%23%2A"); assertPosted(DEFAULT_REGION, "Action=DescribeInstances&Filter.1.Name=instance-state-name&Filter.1.Value.1=terminated&Filter.1.Value.2=shutting-down&Filter.2.Name=key-name&Filter.2.Value.1=jclouds%23sg-3c6ef654"); assertPosted(DEFAULT_REGION, "Action=DeleteKeyPair&KeyName=jclouds%23sg-3c6ef654"); assertPosted(DEFAULT_REGION, "Action=DescribePlacementGroups&GroupName.1=jclouds%23sg-3c6ef654%23us-east-1");