brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [1/2] incubator-brooklyn git commit: fix bug where missing script dir causes null script dir explicitly set in ssh tool
Date Sun, 01 Feb 2015 00:33:58 GMT
Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master adc0ba61f -> 8c5dc9ddf


fix bug where missing script dir causes null script dir explicitly set in ssh tool

introduced in #476


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

Branch: refs/heads/master
Commit: 62a285c50541ce8ccb4a51c2a3e4fb31e0eca48c
Parents: adc0ba6
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Sun Feb 1 00:30:32 2015 +0000
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Sun Feb 1 00:30:32 2015 +0000

----------------------------------------------------------------------
 .../brooklyn/location/basic/SshMachineLocation.java  |  2 +-
 .../basic/SshMachineLocationIntegrationTest.java     | 15 +++++++++++++++
 .../brooklyn/location/jclouds/JcloudsLocation.java   |  2 +-
 3 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/62a285c5/core/src/main/java/brooklyn/location/basic/SshMachineLocation.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/location/basic/SshMachineLocation.java b/core/src/main/java/brooklyn/location/basic/SshMachineLocation.java
index 9482d02..172b58c 100644
--- a/core/src/main/java/brooklyn/location/basic/SshMachineLocation.java
+++ b/core/src/main/java/brooklyn/location/basic/SshMachineLocation.java
@@ -647,7 +647,7 @@ public class SshMachineLocation extends AbstractLocation implements MachineLocat
     private Map<String, Object> augmentPropertiesWithSshConfigGivenToProps(Map<String,
?> props) {
         Map<String,Object> augmentedProps = Maps.newHashMap(props);
         for (ConfigKey<?> config : SSH_CONFIG_GIVEN_TO_PROPS) {
-            if (!props.containsKey(config.getName()))
+            if (!augmentedProps.containsKey(config.getName()) && hasConfig(config,
true))
                 augmentedProps.put(config.getName(), getConfig(config));
         }
         return augmentedProps;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/62a285c5/core/src/test/java/brooklyn/location/basic/SshMachineLocationIntegrationTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/location/basic/SshMachineLocationIntegrationTest.java
b/core/src/test/java/brooklyn/location/basic/SshMachineLocationIntegrationTest.java
index 63f5902..9c85e95 100644
--- a/core/src/test/java/brooklyn/location/basic/SshMachineLocationIntegrationTest.java
+++ b/core/src/test/java/brooklyn/location/basic/SshMachineLocationIntegrationTest.java
@@ -114,4 +114,19 @@ public class SshMachineLocationIntegrationTest {
         int rc = sm.execScript("Test script directory execution", ImmutableList.of(command));
         assertEquals(rc, 0);
     }
+    
+    @Test(groups = "Integration")
+    public void testMissingLocationScriptDirIsAlsoOkay() throws Exception {
+        final String command = "echo hello";
+
+        Map<String, Object> locationConfig = ImmutableMap.<String, Object>builder()
+//                .put(SshMachineLocation.SCRIPT_DIR.getName(), "/var/tmp")
+                .build();
+
+        LocalhostMachineProvisioningLocation lhp = (LocalhostMachineProvisioningLocation)
mgmt.getLocationRegistry().resolve("localhost", locationConfig);
+        SshMachineLocation sm = lhp.obtain();
+
+        int rc = sm.execScript("Test script directory execution", ImmutableList.of(command));
+        assertEquals(rc, 0);
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/62a285c5/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 7abbaca..37272d4 100644
--- a/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java
+++ b/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java
@@ -1694,7 +1694,7 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation
im
                     .configureIfNotNull(CLOUD_REGION_ID, nodeRegion)
                     .configure(CALLER_CONTEXT, setup.get(CALLER_CONTEXT))
                     .configure(SshMachineLocation.DETECT_MACHINE_DETAILS, setup.get(SshMachineLocation.DETECT_MACHINE_DETAILS))
-                    .configure(SshMachineLocation.SCRIPT_DIR, setup.get(SshMachineLocation.SCRIPT_DIR))
+                    .configureIfNotNull(SshMachineLocation.SCRIPT_DIR, setup.get(SshMachineLocation.SCRIPT_DIR))
                     .configureIfNotNull(USE_PORT_FORWARDING, setup.get(USE_PORT_FORWARDING))
                     .configureIfNotNull(PORT_FORWARDER, setup.get(PORT_FORWARDER))
                     .configureIfNotNull(PORT_FORWARDING_MANAGER, setup.get(PORT_FORWARDING_MANAGER)));


Mime
View raw message