Fix jclouds createUser, with password override Previously if the createUser was configured to use a specific password for that new user, then it would also try to login to run the createUser command using that password (rather that use the contents of the initialCredentials).
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/2f9e0e66 Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/2f9e0e66 Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/2f9e0e66 Branch: refs/heads/master Commit: 2f9e0e66ccf0dc92d526cb67b87bbf8e39d8551c Parents: cee066e Author: Aled Sage <[email protected]> Authored: Mon Jul 13 16:35:07 2015 +0100 Committer: Aled Sage <[email protected]> Committed: Mon Jul 13 17:36:24 2015 +0100 ---------------------------------------------------------------------- .../java/brooklyn/location/jclouds/JcloudsLocation.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/2f9e0e66/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java ---------------------------------------------------------------------- diff --git a/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java b/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java index 214f946..966cb4a 100644 --- a/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java +++ b/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java @@ -1531,8 +1531,16 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im sshProps.put("user", initialUser); sshProps.put("address", address); sshProps.put("port", port); - if (initialPassword.isPresent()) sshProps.put("password", initialPassword.get()); - if (initialPrivateKey.isPresent()) sshProps.put("privateKeyData", initialPrivateKey.get()); + if (initialPassword.isPresent()) { + sshProps.put("password", initialPassword.get()); + } else { + sshProps.remove("password"); + } + if (initialPrivateKey.isPresent()) { + sshProps.put("privateKeyData", initialPrivateKey.get()); + } else { + sshProps.remove("privateKeyData"); + } // TODO Retrying lots of times as workaround for vcloud-director. There the guest customizations // can cause the VM to reboot shortly after it was ssh'able.
