You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by dr...@apache.org on 2017/05/31 15:11:59 UTC

[1/6] brooklyn-server git commit: Improve javadoc of JcloudsLocation.registerMachine

Repository: brooklyn-server
Updated Branches:
  refs/heads/master d7b8b0cc0 -> ad5d43eb9


Improve javadoc of JcloudsLocation.registerMachine

Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/49543d09
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/49543d09
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/49543d09

Branch: refs/heads/master
Commit: 49543d09286ab72fc2d12afda8aa293011e32c53
Parents: 4105fd4
Author: Aled Sage <al...@gmail.com>
Authored: Tue May 30 11:47:11 2017 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Tue May 30 16:32:48 2017 +0100

----------------------------------------------------------------------
 .../location/jclouds/JcloudsLocation.java       | 22 +++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/49543d09/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
index 05bac2a..0293c94 100644
--- a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
+++ b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
@@ -1784,12 +1784,24 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im
     /**
      * Brings an existing machine with the given details under management.
      * <p>
-     * Required fields are:
-     * <ul>
-     *   <li>id: the jclouds VM id, e.g. "eu-west-1/i-5504f21d" (NB this is {@see JcloudsMachineLocation#getJcloudsId()} not #getId())
-     *   <li>hostname: the public hostname or IP of the machine, e.g. "ec2-176-34-93-58.eu-west-1.compute.amazonaws.com"
-     *   <li>userName: the username for sshing into the machine (for use if it is not a Windows system)
+     * The args passed in are used to match against an existing machine. The machines are listed
+     * (see @link #listMachines()}), and each is compared against the given args. There should
+     * be exactly one matching machine.
+     * <p>
+     * Arguments that can be used for matching are:
      * <ul>
+     *   <li>{@code id}: the cloud provider's VM id, e.g. "eu-west-1/i-5504f21d" (NB this is 
+     *       {@see JcloudsMachineLocation#getJcloudsId()} not #getId())
+     *   <li>{@code hostname}: the public hostname or IP of the machine, 
+     *       e.g. "ec2-176-34-93-58.eu-west-1.compute.amazonaws.com"
+     * </ul>
+     * 
+     * Other config options can also be passed in, for subsequent usage of the machine. For example,
+     * {@code user} will deterine the username subsequently used for ssh or WinRM. See the standard
+     * config options of {@link JcloudsLocation}, {@link SshMachineLocation} and 
+     * {@link WinRmMachineLocation}.
+     * 
+     * @throws IllegalArgumentException if there is not exactly one match
      */
     public JcloudsMachineLocation registerMachine(ConfigBag flags) throws NoMachinesAvailableException {
         ConfigBag setup = ConfigBag.newInstanceExtending(config().getBag(), flags.getAllConfig());


[5/6] brooklyn-server git commit: JcloudsLocation: use merged config for WAIT_WINDOWS_TO_START

Posted by dr...@apache.org.
JcloudsLocation: use merged config for WAIT_WINDOWS_TO_START

Use `setup` (which combines location’s config and args passed to
obtain(), such as from entity’s `provisioning.properties`).

Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/3f06cad1
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/3f06cad1
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/3f06cad1

Branch: refs/heads/master
Commit: 3f06cad153c767b1fbfe2149e25d7f2d04405512
Parents: b987fb1
Author: Aled Sage <al...@gmail.com>
Authored: Tue May 30 11:14:18 2017 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Tue May 30 16:32:48 2017 +0100

----------------------------------------------------------------------
 .../java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/3f06cad1/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
index 7bce8f7..8652c50 100644
--- a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
+++ b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
@@ -2456,7 +2456,7 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im
                     if (success) {
                         credsSuccessful.set(machinesToTry.getRight());
 
-                        String verifyWindowsUp = getConfig(WinRmMachineLocation.WAIT_WINDOWS_TO_START);
+                        String verifyWindowsUp = setup.get(WinRmMachineLocation.WAIT_WINDOWS_TO_START);
                         if (Strings.isBlank(verifyWindowsUp) || verifyWindowsUp.equals("false")) {
                             return true;
                         }


[4/6] brooklyn-server git commit: JcloudsLocation: call unmanage after createTemporarySshMachineLocation

Posted by dr...@apache.org.
JcloudsLocation: call unmanage after createTemporarySshMachineLocation

Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/b987fb15
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/b987fb15
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/b987fb15

Branch: refs/heads/master
Commit: b987fb159a0cc975bc1954eee3b89ed557394c7c
Parents: 6b5f748
Author: Aled Sage <al...@gmail.com>
Authored: Tue May 30 11:13:17 2017 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Tue May 30 16:32:48 2017 +0100

----------------------------------------------------------------------
 .../brooklyn/location/jclouds/JcloudsLocation.java     | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/b987fb15/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
index 9fd4b36..7bce8f7 100644
--- a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
+++ b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
@@ -1727,7 +1727,9 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im
                         LOG.warn("exit code {} when creating user for {}; usage may subsequently fail", exitcode, node);
                     }
                 } finally {
-                    getManagementContext().getLocationManager().unmanage(sshLoc);
+                    if (getManagementContext().getLocationManager().isManaged(sshLoc)) {
+                        getManagementContext().getLocationManager().unmanage(sshLoc);
+                    }
                     Streams.closeQuietly(sshLoc);
                 }
             }
@@ -2901,11 +2903,9 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im
     }
 
     String getHostnameAws(HostAndPort hostAndPort, LoginCredentials userCredentials, ConfigBag setup) {
-        SshMachineLocation sshLocByIp = null;
+        // TODO messy way to get an SSH session
+        SshMachineLocation sshLocByIp = createTemporarySshMachineLocation(hostAndPort, userCredentials, setup);
         try {
-            // TODO messy way to get an SSH session
-            sshLocByIp = createTemporarySshMachineLocation(hostAndPort, userCredentials, setup);
-
             ByteArrayOutputStream outStream = new ByteArrayOutputStream();
             ByteArrayOutputStream errStream = new ByteArrayOutputStream();
             int exitcode = sshLocByIp.execCommands(
@@ -2921,6 +2921,9 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im
             }
             throw new IllegalStateException("Could not obtain aws-ec2 hostname for vm "+hostAndPort+"; exitcode="+exitcode+"; stdout="+outString+"; stderr="+new String(errStream.toByteArray()));
         } finally {
+            if (getManagementContext().getLocationManager().isManaged(sshLocByIp)) {
+                getManagementContext().getLocationManager().unmanage(sshLocByIp);
+            }
             Streams.closeQuietly(sshLocByIp);
         }
     }


[2/6] brooklyn-server git commit: JcloudsLocation.createTemporarySshMachineLocation: sshToolClass not special

Posted by dr...@apache.org.
JcloudsLocation.createTemporarySshMachineLocation: sshToolClass not special

Just rely on any `sshToolClass` config being passed in the ConfigBag
arg (rather than also looking up jcloudsLocation.config()). The passed
in ConfigBag should be a merger of the location’s config and any
additional config that has been passed in.


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/4105fd46
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/4105fd46
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/4105fd46

Branch: refs/heads/master
Commit: 4105fd462f0726c6b799731a1f220ca8be97d48d
Parents: 3f06cad
Author: Aled Sage <al...@gmail.com>
Authored: Tue May 30 11:16:09 2017 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Tue May 30 16:32:48 2017 +0100

----------------------------------------------------------------------
 .../brooklyn/location/jclouds/JcloudsLocation.java   |  4 ----
 .../jclouds/DefaultConnectivityResolverTest.java     | 15 ++++++++-------
 2 files changed, 8 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/4105fd46/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
index 8652c50..05bac2a 100644
--- a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
+++ b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
@@ -1611,10 +1611,6 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im
         sshProps.put("port", hostAndPort.getPort());
         sshProps.put(AbstractLocation.TEMPORARY_LOCATION.getName(), true);
         sshProps.put(LocalLocationManager.CREATE_UNMANAGED.getName(), true);
-        String sshClass = config().get(SshMachineLocation.SSH_TOOL_CLASS);
-        if (Strings.isNonBlank(sshClass)) {
-            sshProps.put(SshMachineLocation.SSH_TOOL_CLASS.getName(), sshClass);
-        }
 
         sshProps.remove("id");
         sshProps.remove("password");

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/4105fd46/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/DefaultConnectivityResolverTest.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/DefaultConnectivityResolverTest.java b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/DefaultConnectivityResolverTest.java
index 6e7d8b0..3e0b046 100644
--- a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/DefaultConnectivityResolverTest.java
+++ b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/DefaultConnectivityResolverTest.java
@@ -55,7 +55,8 @@ public class DefaultConnectivityResolverTest extends AbstractJcloudsStubbedUnitT
                 .portForwardSshOverride(HostAndPort.fromParts("10.1.1.4", 4361))
                 .build();
         DefaultConnectivityResolver customizer = new DefaultConnectivityResolver();
-        ManagementAddressResolveResult result = customizer.resolve(jcloudsLocation, newNodeMetadata(), ConfigBag.newInstance(), options);
+        ConfigBag configBag = jcloudsLocation.config().getBag();
+        ManagementAddressResolveResult result = customizer.resolve(jcloudsLocation, newNodeMetadata(), configBag, options);
         assertEquals(result.hostAndPort().getHostText(), "10.1.1.4");
         assertEquals(result.hostAndPort().getPort(), 4361);
     }
@@ -72,7 +73,7 @@ public class DefaultConnectivityResolverTest extends AbstractJcloudsStubbedUnitT
                 .userCredentials(credential)
                 .build();
         DefaultConnectivityResolver customizer = new DefaultConnectivityResolver();
-        ConfigBag configBag = ConfigBag.newInstance();
+        ConfigBag configBag = jcloudsLocation.config().getBag();
         ManagementAddressResolveResult result = customizer.resolve(
                 jcloudsLocation, newNodeMetadata(), configBag, options);
         assertEquals(result.hostAndPort().getHostText(), expectedHostname);
@@ -91,7 +92,7 @@ public class DefaultConnectivityResolverTest extends AbstractJcloudsStubbedUnitT
         });
         initNodeCreatorAndJcloudsLocation(newNodeCreator(), ImmutableMap.of());
         DefaultConnectivityResolver customizer = new DefaultConnectivityResolver();
-        final ConfigBag config = ConfigBag.newInstance(ImmutableMap.of(
+        final ConfigBag config = ConfigBag.newInstanceExtending(jcloudsLocation.config().getBag(), ImmutableMap.of(
                 JcloudsLocationConfig.WAIT_FOR_SSHABLE, "1ms",
                 JcloudsLocationConfig.POLL_FOR_FIRST_REACHABLE_ADDRESS, "1ms"));
         assertTrue(customizer.checkCredential(
@@ -114,7 +115,7 @@ public class DefaultConnectivityResolverTest extends AbstractJcloudsStubbedUnitT
         });
         initNodeCreatorAndJcloudsLocation(newNodeCreator(), ImmutableMap.of());
         DefaultConnectivityResolver customizer = new DefaultConnectivityResolver();
-        final ConfigBag config = ConfigBag.newInstance(ImmutableMap.of(
+        final ConfigBag config = ConfigBag.newInstanceExtending(jcloudsLocation.config().getBag(), ImmutableMap.of(
                 JcloudsLocationConfig.WAIT_FOR_WINRM_AVAILABLE, "1ms",
                 JcloudsLocationConfig.POLL_FOR_FIRST_REACHABLE_ADDRESS, "1ms"));
         assertTrue(customizer.checkCredential(
@@ -146,7 +147,7 @@ public class DefaultConnectivityResolverTest extends AbstractJcloudsStubbedUnitT
                 return new RecordingSshTool.CustomResponse(exitCode, "", "");
             }
         });
-        ConfigBag config = ConfigBag.newInstance(ImmutableMap.of(
+        ConfigBag config = ConfigBag.newInstanceExtending(jcloudsLocation.config().getBag(), ImmutableMap.of(
                 JcloudsLocationConfig.LOOKUP_AWS_HOSTNAME, false,
                 JcloudsLocationConfig.WAIT_FOR_SSHABLE, "1ms",
                 JcloudsLocationConfig.POLL_FOR_FIRST_REACHABLE_ADDRESS, "1ms",
@@ -194,7 +195,7 @@ public class DefaultConnectivityResolverTest extends AbstractJcloudsStubbedUnitT
                 JcloudsLocationConfig.CONNECTIVITY_RESOLVER, customizer));
 
         ConnectivityResolverOptions options = newResolveOptionsForIps(reachableIps, Duration.millis(100)).build();
-        ConfigBag configBag = ConfigBag.newInstance();
+        ConfigBag configBag = jcloudsLocation.config().getBag();
 
         ManagementAddressResolveResult result = customizer.resolve(jcloudsLocation, newNodeMetadata(), configBag, options);
         assertEquals(result.hostAndPort().getHostText(), expectedIp);
@@ -223,7 +224,7 @@ public class DefaultConnectivityResolverTest extends AbstractJcloudsStubbedUnitT
                 JcloudsLocationConfig.CONNECTIVITY_RESOLVER, customizer));
 
         ConnectivityResolverOptions options = newResolveOptionsForIps(reachableIps, Duration.ONE_MILLISECOND).build();
-        ConfigBag configBag = ConfigBag.newInstance();
+        ConfigBag configBag = jcloudsLocation.config().getBag();
         customizer.resolve(jcloudsLocation, newNodeMetadata(), configBag, options);
     }
 


[6/6] brooklyn-server git commit: This closes #710

Posted by dr...@apache.org.
This closes #710


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/ad5d43eb
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/ad5d43eb
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/ad5d43eb

Branch: refs/heads/master
Commit: ad5d43eb905d97b7d72afcdd92d975272ff9d42f
Parents: d7b8b0c 49543d0
Author: Duncan Godwin <dr...@googlemail.com>
Authored: Wed May 31 16:11:50 2017 +0100
Committer: Duncan Godwin <dr...@googlemail.com>
Committed: Wed May 31 16:11:50 2017 +0100

----------------------------------------------------------------------
 .../jclouds/JcloudsByonLocationResolver.java    |  3 +-
 .../location/jclouds/JcloudsLocation.java       | 53 ++++++++++++--------
 .../DefaultConnectivityResolverTest.java        | 15 +++---
 3 files changed, 42 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ad5d43eb/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
----------------------------------------------------------------------


[3/6] brooklyn-server git commit: Fix JcloudsLocation.registerMachine(ConfigBag)

Posted by dr...@apache.org.
Fix JcloudsLocation.registerMachine(ConfigBag)

It now combines the config().getBag() with the config passed in.

Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/6b5f748b
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/6b5f748b
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/6b5f748b

Branch: refs/heads/master
Commit: 6b5f748b594e17f272c059738af1227456009f89
Parents: 947d5ae
Author: Aled Sage <al...@gmail.com>
Authored: Tue May 30 10:57:10 2017 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Tue May 30 16:32:48 2017 +0100

----------------------------------------------------------------------
 .../location/jclouds/JcloudsByonLocationResolver.java   |  3 ++-
 .../brooklyn/location/jclouds/JcloudsLocation.java      | 12 ++++++------
 2 files changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6b5f748b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsByonLocationResolver.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsByonLocationResolver.java b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsByonLocationResolver.java
index dac284f..31ef408 100644
--- a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsByonLocationResolver.java
+++ b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsByonLocationResolver.java
@@ -43,6 +43,7 @@ import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Supplier;
 import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Lists;
 
 /**
@@ -155,7 +156,7 @@ public class JcloudsByonLocationResolver extends AbstractLocationResolver implem
                 for (Map<?,?> machineFlags : machinesFlags) {
                     try {
                         jcloudsLocation.config().putAll(machineFlags);
-                        JcloudsMachineLocation machine = jcloudsLocation.registerMachine(jcloudsLocation.config().getBag());
+                        JcloudsMachineLocation machine = jcloudsLocation.registerMachine(ImmutableMap.of());
                         result.add(machine);
                     } catch (NoMachinesAvailableException e) {
                         Map<?,?> sanitizedMachineFlags = Sanitizer.sanitize(machineFlags);

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6b5f748b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
index e91b588..9fd4b36 100644
--- a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
+++ b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
@@ -1772,11 +1772,11 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im
 
     // ----------------- registering existing machines ------------------------
 
-    protected MachineLocation registerMachine(NodeMetadata metadata) throws NoMachinesAvailableException {
+    protected JcloudsMachineLocation registerMachine(NodeMetadata metadata) throws NoMachinesAvailableException {
         return registerMachine(MutableMap.of(), metadata);
     }
 
-    protected MachineLocation registerMachine(Map<?, ?> flags, NodeMetadata metadata) throws NoMachinesAvailableException {
+    protected JcloudsMachineLocation registerMachine(Map<?, ?> flags, NodeMetadata metadata) throws NoMachinesAvailableException {
         ConfigBag setup = ConfigBag.newInstanceExtending(config().getBag(), flags);
         if (!setup.containsKey("id")) setup.putStringKey("id", metadata.getId());
         setHostnameUpdatingCredentials(setup, metadata);
@@ -1793,7 +1793,8 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im
      *   <li>userName: the username for sshing into the machine (for use if it is not a Windows system)
      * <ul>
      */
-    public JcloudsMachineLocation registerMachine(ConfigBag setup) throws NoMachinesAvailableException {
+    public JcloudsMachineLocation registerMachine(ConfigBag flags) throws NoMachinesAvailableException {
+        ConfigBag setup = ConfigBag.newInstanceExtending(config().getBag(), flags.getAllConfig());
         NodeMetadata node = findNodeOrThrow(setup);
         return registerMachineLocation(setup, node);
     }
@@ -1871,9 +1872,8 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im
         return node;
     }
 
-    public MachineLocation registerMachine(Map<?,?> flags) throws NoMachinesAvailableException {
-        ConfigBag setup = ConfigBag.newInstanceExtending(config().getBag(), flags);
-        return registerMachine(setup);
+    public JcloudsMachineLocation registerMachine(Map<?,?> flags) throws NoMachinesAvailableException {
+        return registerMachine(ConfigBag.newInstance(flags));
     }
 
     /**