Merge pull request #252 from aplowe/master

Bug fix for Terremark ECloud compute service
This commit is contained in:
Adrian Cole 2011-12-16 10:10:52 -08:00
commit b3838dab2d
3 changed files with 4 additions and 4 deletions

View File

@ -81,6 +81,6 @@ public class CreateUniqueKeyPair implements Function<OrgAndName, KeyPair> {
}
private String getNextName(String keyPairName) {
return "jclouds#" + keyPairName + "#" + randomSuffix.get();
return "jclouds_" + keyPairName.replaceAll("-", "_") + "_" + randomSuffix.get();
}
}

View File

@ -54,7 +54,7 @@ public class DeleteKeyPair {
public void execute(OrgAndName orgTag) {
for (KeyPair keyPair : terremarkClient.listKeyPairsInOrg(orgTag.getOrg())) {
if (keyPair.getName().matches("jclouds#" + orgTag.getName() + "#[0-9a-f]+")) {
if (keyPair.getName().matches("jclouds_" + orgTag.getName().replaceAll("-", "_") + "_[0-9a-f]+")) {
logger.debug(">> deleting keyPair(%s)", keyPair.getName());
terremarkClient.deleteKeyPair(keyPair.getId());
// TODO: test this clear happens

View File

@ -75,7 +75,7 @@ public class DeleteKeyPairTest {
// setup expectations
expect(strategy.terremarkClient.listKeyPairsInOrg(orgTag.getOrg())).andReturn(ImmutableSet.<KeyPair> of(keyPair));
expect(keyPair.getName()).andReturn("jclouds#" + orgTag.getName() + "#123").atLeastOnce();
expect(keyPair.getName()).andReturn("jclouds_" + orgTag.getName() + "_123").atLeastOnce();
expect(keyPair.getId()).andReturn(URI.create("1245"));
strategy.terremarkClient.deleteKeyPair(URI.create("1245"));
expect(strategy.credentialsMap.remove(orgTag)).andReturn(null);
@ -104,7 +104,7 @@ public class DeleteKeyPairTest {
// setup expectations
expect(strategy.terremarkClient.listKeyPairsInOrg(orgTag.getOrg())).andReturn(ImmutableSet.<KeyPair> of(keyPair));
expect(keyPair.getName()).andReturn("kclouds#" + orgTag.getName() + "-123");
expect(keyPair.getName()).andReturn("kclouds_" + orgTag.getName() + "_123");
// replay mocks
replay(keyPair);