JCLOUDS-1033: Don't fail if no private key has been provided in DigitalOcean
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/575d39e7 Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/575d39e7 Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/575d39e7 Branch: refs/heads/master Commit: 575d39e7c5c9974ecbe080a09a2787d08534ac3a Parents: 3fbd399 Author: Ignasi Barrera <[email protected]> Authored: Mon Nov 2 13:03:55 2015 +0100 Committer: Ignasi Barrera <[email protected]> Committed: Mon Nov 16 22:58:29 2015 +0100 ---------------------------------------------------------------------- .../compute/strategy/CreateKeyPairsThenCreateNodes.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/jclouds/blob/575d39e7/providers/digitalocean2/src/main/java/org/jclouds/digitalocean2/compute/strategy/CreateKeyPairsThenCreateNodes.java ---------------------------------------------------------------------- diff --git a/providers/digitalocean2/src/main/java/org/jclouds/digitalocean2/compute/strategy/CreateKeyPairsThenCreateNodes.java b/providers/digitalocean2/src/main/java/org/jclouds/digitalocean2/compute/strategy/CreateKeyPairsThenCreateNodes.java index 3e4aae3..bc304b7 100644 --- a/providers/digitalocean2/src/main/java/org/jclouds/digitalocean2/compute/strategy/CreateKeyPairsThenCreateNodes.java +++ b/providers/digitalocean2/src/main/java/org/jclouds/digitalocean2/compute/strategy/CreateKeyPairsThenCreateNodes.java @@ -16,7 +16,6 @@ */ package org.jclouds.digitalocean2.compute.strategy; -import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import java.security.PublicKey; @@ -101,11 +100,11 @@ public class CreateKeyPairsThenCreateNodes extends CreateNodesWithGroupEncodedIn generateKeyPairAndAddKeyToSet(options, generatedSshKeyIds, group); } - // If there is a script to run in the node, make sure a private key has been configured so jclouds will be able to - // access the node - if (options.getRunScript() != null) { - checkArgument(!Strings.isNullOrEmpty(options.getLoginPrivateKey()), - "no private key configured for: %s; please use options.overrideLoginPrivateKey(rsa_private_text)", group); + // If there is a script to run in the node, make sure a private key has + // been configured so jclouds will be able to access the node + if (options.getRunScript() != null && Strings.isNullOrEmpty(options.getLoginPrivateKey())) { + logger.warn(">> A runScript has been configured but no SSH key has been provided." + + " Authentication will delegate to the ssh-agent"); } // If there is a key configured, then make sure there is a key pair for it
