brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [2/6] incubator-brooklyn git commit: Don't create install dir in copy-pre-install-resources unless there are resources to install.
Date Tue, 02 Jun 2015 17:17:57 GMT
Don't create install dir in copy-pre-install-resources unless there are resources to install.

Lots of unit tests assume that no ssh connection will be established when testing localhot
entities. The addition of copy-pre-install-resources breaks the tests if local ssh is not
configured properly. Create install dir only if there are resources to copy (and therefore
the test expects it will try to ssh).


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

Branch: refs/heads/master
Commit: 47c6f4e74f31a521e7cb0c4ff35f5f00ba489732
Parents: 2889611
Author: Svetoslav Neykov <svetoslav.neykov@cloudsoftcorp.com>
Authored: Mon Jun 1 17:50:43 2015 +0300
Committer: Svetoslav Neykov <svetoslav.neykov@cloudsoftcorp.com>
Committed: Tue Jun 2 19:48:40 2015 +0300

----------------------------------------------------------------------
 .../basic/AbstractSoftwareProcessDriver.java    | 38 ++++++++++----------
 1 file changed, 20 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/47c6f4e7/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessDriver.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessDriver.java
b/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessDriver.java
index a5a4cde..9fa6950 100644
--- a/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessDriver.java
+++ b/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessDriver.java
@@ -31,7 +31,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import brooklyn.config.ConfigKey;
-import brooklyn.entity.software.SshEffectorTasks;
 import brooklyn.location.Location;
 import brooklyn.util.ResourceUtils;
 import brooklyn.util.collections.MutableMap;
@@ -296,27 +295,30 @@ public abstract class AbstractSoftwareProcessDriver implements SoftwareProcessDr
         // Ensure environment variables are not looked up here, otherwise sub-classes might
         // lookup port numbers and fail with ugly error if port is not set; better to wait
         // until in Entity's code (e.g. customize) where such checks are done explicitly.
-        createDirectory(getInstallDir(), "create install directory");
 
-        // TODO see comment in copyResource, that should be queued as a task like the above
-        // (better reporting in activities console)
-
-        if (files != null && files.size() > 0) {
-            for (String source : files.keySet()) {
-                String target = files.get(source);
-                String destination = Os.isAbsolutish(target) ? target : Os.mergePathsUnix(getInstallDir(),
target);
-                copyResource(source, destination, true);
+        boolean hasAnythingToCopy = ((files != null && files.size() > 0) || (templates
!= null && templates.size() > 0));
+        if (hasAnythingToCopy) {
+            createDirectory(getInstallDir(), "create install directory");
+    
+            // TODO see comment in copyResource, that should be queued as a task like the
above
+            // (better reporting in activities console)
+    
+            if (files != null && files.size() > 0) {
+                for (String source : files.keySet()) {
+                    String target = files.get(source);
+                    String destination = Os.isAbsolutish(target) ? target : Os.mergePathsUnix(getInstallDir(),
target);
+                    copyResource(source, destination, true);
+                }
             }
-        }
-
-        if (templates != null && templates.size() > 0) {
-            for (String source : templates.keySet()) {
-                String target = templates.get(source);
-                String destination = Os.isAbsolutish(target) ? target : Os.mergePathsUnix(getInstallDir(),
target);
-                copyTemplate(source, destination, true, MutableMap.<String, Object>of());
+    
+            if (templates != null && templates.size() > 0) {
+                for (String source : templates.keySet()) {
+                    String target = templates.get(source);
+                    String destination = Os.isAbsolutish(target) ? target : Os.mergePathsUnix(getInstallDir(),
target);
+                    copyTemplate(source, destination, true, MutableMap.<String, Object>of());
+                }
             }
         }
-
     }
 
     protected abstract void createDirectory(String directoryName, String summaryForLogging);


Mime
View raw message