nacx requested changes on this pull request.

Thanks @andreaturli! Great work here. Just a couple comments!

> -                  .sharedNameForGroup(group)));
-         keyPairCache.asMap().put(RegionAndName.fromRegionAndName(region, 
keyPair.getName()), keyPair);
-         templateOptions.keyPairName(keyPair.getName());
-         tagsBuilder.add(JCLOUDS_KP);
-      } else if (templateOptions.getKeyPairName() != null) {
-         checkArgument(keyPairExtensionPresent,
-                  "Key Pairs are required by options, but the extension is not 
available! options: %s", templateOptions);
-         if (templateOptions.getLoginPrivateKey() != null) {
-            String pem = templateOptions.getLoginPrivateKey();
-            KeyPair keyPair = 
KeyPair.builder().name(templateOptions.getKeyPairName())
-                     
.fingerprint(fingerprintPrivateKey(pem)).privateKey(pem).build();
-            keyPairCache.asMap().put(RegionAndName.fromRegionAndName(region, 
keyPair.getName()), keyPair);
+         checkArgument(novaApi.getKeyPairApi(region).isPresent(),
+                 "Key Pairs are required by options, but the extension is not 
available! options: %s", templateOptions);
+      }
+      if (templateOptions.shouldGenerateKeyPair()) {

Should we check instead if the user configured inbound ports?
I see that the groups are just passed through to the server options, so n need 
for the extension api if the user only sets the security group names?

>        if (templateOptions.getKeyPairName() != null) {
          options.keyPairName(templateOptions.getKeyPairName());
-         KeyPair keyPair = 
keyPairCache.getIfPresent(RegionAndName.fromRegionAndName(template.getLocation().getId(),
 templateOptions.getKeyPairName()));
-         if (keyPair != null && keyPair.getPrivateKey() != null) {
-            privateKey = Optional.of(keyPair.getPrivateKey());
-            credentialsBuilder.privateKey(privateKey.get());
-         }

We need this code. Users using an existing, pre-created keypair won't be able 
to login to the node since the private key won't be populated to the login 
credentials.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1117#pullrequestreview-50014187

Reply via email to