Fix JcloudsLocation rebindMachine to work like obtainOnce with ConfigBag.newInstanceExtending
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/224fca67 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/224fca67 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/224fca67 Branch: refs/heads/0.6.0 Commit: 224fca673cb2bb8933baabbf3afc6f30e1704830 Parents: 9458604 Author: Andrew Kennedy <[email protected]> Authored: Tue Nov 12 18:37:44 2013 +0000 Committer: Andrew Kennedy <[email protected]> Committed: Tue Nov 12 18:37:44 2013 +0000 ---------------------------------------------------------------------- .../main/java/brooklyn/location/jclouds/JcloudsLocation.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/224fca67/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 77389b0..636f825 100644 --- a/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java +++ b/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java @@ -375,7 +375,7 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im if (attempts == null || attempts < 1) attempts = 1; for (int i = 1; i <= attempts; i++) { try { - return obtainOnce(flags, setup); + return obtainOnce(setup); } catch (RuntimeException e) { LOG.warn("Attempt #{}/{} to obtain machine threw error: {}", new Object[]{i, attempts, e}); exceptions.add(e); @@ -394,7 +394,7 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im } } - protected JcloudsSshMachineLocation obtainOnce(Map<?, ?> flags, ConfigBag setup) throws NoMachinesAvailableException { + protected JcloudsSshMachineLocation obtainOnce(ConfigBag setup) throws NoMachinesAvailableException { AccessController.Response access = getManagementContext().getAccessController().canProvisionLocation(this); if (!access.isAllowed()) { throw new IllegalStateException("Access controller forbids provisioning in "+this+": "+access.getMsg()); @@ -1056,8 +1056,10 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im throw Exceptions.propagate(e); } } + public JcloudsSshMachineLocation rebindMachine(Map flags) throws NoMachinesAvailableException { - return rebindMachine(new ConfigBag().putAll(flags)); + ConfigBag setup = ConfigBag.newInstanceExtending(getConfigBag(), flags); + return rebindMachine(setup); } // -------------- create the SshMachineLocation instance, and connect to it etc ------------------------
