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.
This commit is contained in:
Stuart Hendren 2015-05-06 12:21:17 +01:00 committed by Ignasi Barrera
parent e92fd921cf
commit 3080965eda
2 changed files with 2 additions and 2 deletions

View File

@ -235,7 +235,7 @@ public class EC2ComputeService extends BaseComputeService {
for (KeyPair keyPair : client.getKeyPairApi().get().describeKeyPairsInRegionWithFilter(region, for (KeyPair keyPair : client.getKeyPairApi().get().describeKeyPairsInRegionWithFilter(region,
ImmutableMultimap.<String, String>builder() ImmutableMultimap.<String, String>builder()
.put("key-name", Strings2.urlEncode( .put("key-name", Strings2.urlEncode(
String.format("jclouds#%s#%s*", group, region).replace('#', delimiter))) String.format("jclouds#%s#*", group).replace('#', delimiter)))
.build())) { .build())) {
String keyName = keyPair.getKeyName(); String keyName = keyPair.getKeyName();
Predicate<String> keyNameMatcher = namingConvention.create().containsGroup(group); Predicate<String> keyNameMatcher = namingConvention.create().containsGroup(group);

View File

@ -253,7 +253,7 @@ public class AWSEC2ComputeServiceApiMockTest extends BaseAWSEC2ApiMockTest {
assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); assertPosted(DEFAULT_REGION, "Action=DescribeRegions");
assertPosted(DEFAULT_REGION, "Action=DescribeSecurityGroups&GroupName.1=jclouds%23sg-3c6ef654"); assertPosted(DEFAULT_REGION, "Action=DescribeSecurityGroups&GroupName.1=jclouds%23sg-3c6ef654");
assertPosted(DEFAULT_REGION, "Action=DeleteSecurityGroup&GroupName=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=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=DeleteKeyPair&KeyName=jclouds%23sg-3c6ef654");
assertPosted(DEFAULT_REGION, "Action=DescribePlacementGroups&GroupName.1=jclouds%23sg-3c6ef654%23us-east-1"); assertPosted(DEFAULT_REGION, "Action=DescribePlacementGroups&GroupName.1=jclouds%23sg-3c6ef654%23us-east-1");