You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by sj...@apache.org on 2014/08/15 23:55:57 UTC

[1/3] git commit: Brooklyn starts if brooklyn.properties is missing

Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master 14af1a510 -> 21a037f75


Brooklyn starts if brooklyn.properties is missing


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

Branch: refs/heads/master
Commit: 8476673181c54890ad5e71630b4199732ef9d142
Parents: 14af1a5
Author: Sam Corbett <sa...@cloudsoftcorp.com>
Authored: Fri Aug 15 18:37:34 2014 +0100
Committer: Sam Corbett <sa...@cloudsoftcorp.com>
Committed: Fri Aug 15 18:37:34 2014 +0100

----------------------------------------------------------------------
 .../src/main/java/brooklyn/launcher/BrooklynLauncher.java      | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/84766731/usage/launcher/src/main/java/brooklyn/launcher/BrooklynLauncher.java
----------------------------------------------------------------------
diff --git a/usage/launcher/src/main/java/brooklyn/launcher/BrooklynLauncher.java b/usage/launcher/src/main/java/brooklyn/launcher/BrooklynLauncher.java
index 083763d..6a2eab6 100644
--- a/usage/launcher/src/main/java/brooklyn/launcher/BrooklynLauncher.java
+++ b/usage/launcher/src/main/java/brooklyn/launcher/BrooklynLauncher.java
@@ -443,7 +443,7 @@ public class BrooklynLauncher {
         if (managementContext == null) {
             if (brooklynProperties == null) {
                 Builder builder = new BrooklynProperties.Factory.Builder();
-                if (globalBrooklynPropertiesFile != null) {
+                if (globalBrooklynPropertiesFile != null && fileExists(globalBrooklynPropertiesFile)) {
                     // brooklyn.properties stores passwords (web-console and cloud credentials), 
                     // so ensure it has sensible permissions
                     checkFileReadable(globalBrooklynPropertiesFile);
@@ -498,6 +498,10 @@ public class BrooklynLauncher {
         return this;
     }
 
+    private boolean fileExists(String file) {
+        return new File(Os.tidyPath(file)).exists();
+    }
+
     private void checkFileReadable(String file) {
         File f = new File(Os.tidyPath(file));
         if (!f.exists()) {


[3/3] git commit: This closes #122

Posted by sj...@apache.org.
This closes #122


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

Branch: refs/heads/master
Commit: 21a037f75e1b68301b1157f711fd38f966ec6d83
Parents: 8476673 726b81d
Author: Sam Corbett <sa...@cloudsoftcorp.com>
Authored: Fri Aug 15 22:11:22 2014 +0100
Committer: Sam Corbett <sa...@cloudsoftcorp.com>
Committed: Fri Aug 15 22:11:22 2014 +0100

----------------------------------------------------------------------
 .../entity/brooklynnode/BrooklynNodeSshDriver.java   | 15 ++++++++-------
 .../entity/brooklynnode/BrooklynNodeTest.java        |  2 +-
 2 files changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------



[2/3] git commit: BrooklynNode copies files with 0600 permissions

Posted by sj...@apache.org.
BrooklynNode copies files with 0600 permissions


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

Branch: refs/heads/master
Commit: 726b81d296d7a0dfd4abf247cbe3ec75a572e782
Parents: 8476673
Author: Sam Corbett <sa...@cloudsoftcorp.com>
Authored: Fri Aug 15 19:33:52 2014 +0100
Committer: Sam Corbett <sa...@cloudsoftcorp.com>
Committed: Fri Aug 15 19:33:52 2014 +0100

----------------------------------------------------------------------
 .../entity/brooklynnode/BrooklynNodeSshDriver.java   | 15 ++++++++-------
 .../entity/brooklynnode/BrooklynNodeTest.java        |  2 +-
 2 files changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/726b81d2/software/base/src/main/java/brooklyn/entity/brooklynnode/BrooklynNodeSshDriver.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/brooklyn/entity/brooklynnode/BrooklynNodeSshDriver.java b/software/base/src/main/java/brooklyn/entity/brooklynnode/BrooklynNodeSshDriver.java
index 74b3f14..cfdbc85 100644
--- a/software/base/src/main/java/brooklyn/entity/brooklynnode/BrooklynNodeSshDriver.java
+++ b/software/base/src/main/java/brooklyn/entity/brooklynnode/BrooklynNodeSshDriver.java
@@ -37,6 +37,7 @@ import brooklyn.location.basic.SshMachineLocation;
 import brooklyn.util.collections.MutableMap;
 import brooklyn.util.file.ArchiveBuilder;
 import brooklyn.util.file.ArchiveUtils;
+import brooklyn.util.internal.ssh.SshTool;
 import brooklyn.util.net.Networking;
 import brooklyn.util.net.Urls;
 import brooklyn.util.os.Os;
@@ -322,14 +323,14 @@ public class BrooklynNodeSshDriver extends JavaSoftwareProcessSshDriver implemen
         SshMachineLocation machine = getMachine();
         String tempRemotePath = String.format("%s/upload.tmp", getRunDir());
 
-        if (contents != null) {
-            machine.copyTo(new ByteArrayInputStream(contents.getBytes()), tempRemotePath);
-        } else if (alternativeUri != null) {
-            InputStream propertiesStream = resource.getResourceFromUrl(alternativeUri);
-            machine.copyTo(propertiesStream, tempRemotePath);
-        } else {
-            throw new IllegalStateException("No contents supplied for file "+remotePath);
+        if (contents == null && alternativeUri == null) {
+            throw new IllegalStateException("No contents supplied for file " + remotePath);
         }
+        InputStream stream = contents != null
+                ? new ByteArrayInputStream(contents.getBytes())
+                : resource.getResourceFromUrl(alternativeUri);
+        Map<String, String> flags = MutableMap.of(SshTool.PROP_PERMISSIONS.getName(), "0600");
+        machine.copyTo(flags, stream, tempRemotePath);
         newScript(CUSTOMIZING)
                 .failOnNonZeroResultCode()
                 .body.append(

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/726b81d2/software/base/src/test/java/brooklyn/entity/brooklynnode/BrooklynNodeTest.java
----------------------------------------------------------------------
diff --git a/software/base/src/test/java/brooklyn/entity/brooklynnode/BrooklynNodeTest.java b/software/base/src/test/java/brooklyn/entity/brooklynnode/BrooklynNodeTest.java
index 9752ec1..c36adbc 100644
--- a/software/base/src/test/java/brooklyn/entity/brooklynnode/BrooklynNodeTest.java
+++ b/software/base/src/test/java/brooklyn/entity/brooklynnode/BrooklynNodeTest.java
@@ -87,7 +87,7 @@ public class BrooklynNodeTest {
     
     @Test
     public void testCanStartSameNode() throws Exception {
-        // not very interesting as done not have REST when run in this project
+        // not very interesting as do not have REST when run in this project
         // but test BrooklynNodeRestTest in downstream project does
         BrooklynNode bn = app.createAndManageChild(EntitySpec.create(BrooklynNode.class, SameBrooklynNodeImpl.class));
         bn.start(MutableSet.<Location>of());