JcloudsLocation#registerMachine handles Windows machines
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/1a5e5e7f Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/1a5e5e7f Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/1a5e5e7f Branch: refs/heads/master Commit: 1a5e5e7f754c272b34c61e3f3a0debe731a42116 Parents: cb36537 Author: Sam Corbett <[email protected]> Authored: Tue Aug 18 18:32:40 2015 +0100 Committer: Sam Corbett <[email protected]> Committed: Fri Aug 21 10:16:43 2015 +0100 ---------------------------------------------------------------------- .../apache/brooklyn/location/jclouds/JcloudsLocation.java | 10 +++++++--- .../jclouds/JcloudsLocationRebindMachineLiveTest.java | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/1a5e5e7f/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 867d349..21d4760 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 @@ -1903,9 +1903,9 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im * <p> * Required fields are: * <ul> - * <li>id: the jclouds VM id, e.g. "eu-west-1/i-5504f21d" (NB this is @see JcloudsSshMachineLocation#getJcloudsId() not #getId()) + * <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 ssh'ing into the machine + * <li>userName: the username for sshing into the machine if it is not a Windows system * <ul> */ public MachineLocation registerMachine(ConfigBag setup) throws NoMachinesAvailableException { @@ -1941,7 +1941,11 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im // TODO confirm we can SSH ? // NB if rawHostname not set, get the hostname using getPublicHostname(node, Optional.<HostAndPort>absent(), setup); - return registerJcloudsSshMachineLocation(computeService, node, null, Optional.<HostAndPort>absent(), setup); + if (isWindows(node, setup)) { + return registerWinRmMachineLocation(computeService, node, null, Optional.<HostAndPort>absent(), setup); + } else { + return registerJcloudsSshMachineLocation(computeService, node, null, Optional.<HostAndPort>absent(), setup); + } } catch (IOException e) { throw Exceptions.propagate(e); http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/1a5e5e7f/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsLocationRebindMachineLiveTest.java ---------------------------------------------------------------------- diff --git a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsLocationRebindMachineLiveTest.java b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsLocationRebindMachineLiveTest.java index bf9ad59..6d891a6 100644 --- a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsLocationRebindMachineLiveTest.java +++ b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsLocationRebindMachineLiveTest.java @@ -52,7 +52,7 @@ public class JcloudsLocationRebindMachineLiveTest extends AbstractJcloudsLiveTes @Test(groups = { "Live", "Live-sanity" }) public void testRebindWithIncorrectId() throws Exception { try { - jcloudsLocation.rebindMachine(ImmutableMap.of("id", "incorrectid", "hostname", "myhostname", "user", "myusername")); + jcloudsLocation.registerMachine(ImmutableMap.of("id", "incorrectid", "hostname", "myhostname", "user", "myusername")); } catch (IllegalArgumentException e) { if (e.getMessage().contains("node not found")) { // success
