brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rich...@apache.org
Subject [06/21] git commit: Add masterless mode configuration key for Salt
Date Wed, 28 May 2014 16:05:22 GMT
Add masterless mode configuration key for Salt


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

Branch: refs/heads/master
Commit: 435966be00eadb290433187a02a6eec035a02d11
Parents: b67d8bd
Author: Andrew Kennedy <andrew.kennedy@cloudsoftcorp.com>
Authored: Wed Oct 23 15:04:12 2013 +0100
Committer: Andrew Kennedy <andrew.kennedy@cloudsoftcorp.com>
Committed: Wed May 28 15:12:54 2014 +0100

----------------------------------------------------------------------
 .../entity/salt/SaltLifecycleEffectorTasks.java  | 19 ++++++++++++-------
 .../java/brooklyn/entity/salt/SaltTasks.java     |  4 +++-
 .../database/postgresql/PostgreSqlSpecs.java     |  2 ++
 3 files changed, 17 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/435966be/software/base/src/main/java/brooklyn/entity/salt/SaltLifecycleEffectorTasks.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/brooklyn/entity/salt/SaltLifecycleEffectorTasks.java
b/software/base/src/main/java/brooklyn/entity/salt/SaltLifecycleEffectorTasks.java
index 908c2e3..b631e88 100644
--- a/software/base/src/main/java/brooklyn/entity/salt/SaltLifecycleEffectorTasks.java
+++ b/software/base/src/main/java/brooklyn/entity/salt/SaltLifecycleEffectorTasks.java
@@ -80,13 +80,18 @@ public class SaltLifecycleEffectorTasks extends MachineLifecycleEffectorTasks
im
         String runDir = Urls.mergePaths(AbstractSoftwareProcessSshDriver.BROOKLYN_HOME_DIR,
                 "apps/"+entity().getApplicationId()+"/salt-entities/"+entity().getId());
 
-        DynamicTasks.queue(
-                SaltTasks.installFormulas(installDir, SaltConfigs.getRequiredConfig(entity(),
SALT_FORMULAS), false),
-                SaltTasks.buildSaltFile(runDir,
-                        SaltConfigs.getRequiredConfig(entity(), SALT_RUN_LIST),
-                        entity().getConfig(SALT_LAUNCH_ATTRIBUTES)),
-                SaltTasks.installSaltMinion(entity(), runDir, installDir, false),
-                SaltTasks.runSalt(runDir));
+        Boolean masterless = entity().getConfig(SaltConfig.MASTERLESS_MODE);
+        if (masterless) {
+            DynamicTasks.queue(
+                    SaltTasks.installFormulas(installDir, SaltConfigs.getRequiredConfig(entity(),
SALT_FORMULAS), false),
+                    SaltTasks.buildSaltFile(runDir,
+                            SaltConfigs.getRequiredConfig(entity(), SALT_RUN_LIST),
+                            entity().getConfig(SALT_LAUNCH_ATTRIBUTES)),
+                    SaltTasks.installSaltMinion(entity(), runDir, installDir, false),
+                    SaltTasks.runSalt(runDir));
+        } else {
+            throw new UnsupportedOperationException("Salt master mode not yet supported for
minions");
+        }
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/435966be/software/base/src/main/java/brooklyn/entity/salt/SaltTasks.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/brooklyn/entity/salt/SaltTasks.java b/software/base/src/main/java/brooklyn/entity/salt/SaltTasks.java
index 39ac3c0..8008602 100644
--- a/software/base/src/main/java/brooklyn/entity/salt/SaltTasks.java
+++ b/software/base/src/main/java/brooklyn/entity/salt/SaltTasks.java
@@ -50,7 +50,9 @@ public class SaltTasks {
                         if (!force) installCmd = BashCommands.alternatives("which salt-minion",
installCmd);
 
                         // Process the minion configuration template
-                        String url = Entities.getRequiredUrlConfig(minion, SaltConfig.MINION_CONFIGURATION_URL);
+                        Boolean masterless = minion.getConfig(SaltConfig.MASTERLESS_MODE);
+                        String url = masterless ? Entities.getRequiredUrlConfig(minion, SaltConfig.MASTERLESS_CONFIGURATION_URL)
+                                                : Entities.getRequiredUrlConfig(minion, SaltConfig.MINION_CONFIGURATION_URL);
                         Map<String, Object> config = MutableMap.<String, Object>builder()
                                 .put("entity", minion)
                                 .put("runDir", runDir)

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/435966be/software/database/src/main/java/brooklyn/entity/database/postgresql/PostgreSqlSpecs.java
----------------------------------------------------------------------
diff --git a/software/database/src/main/java/brooklyn/entity/database/postgresql/PostgreSqlSpecs.java
b/software/database/src/main/java/brooklyn/entity/database/postgresql/PostgreSqlSpecs.java
index f12f5dc..33a98da 100644
--- a/software/database/src/main/java/brooklyn/entity/database/postgresql/PostgreSqlSpecs.java
+++ b/software/database/src/main/java/brooklyn/entity/database/postgresql/PostgreSqlSpecs.java
@@ -3,6 +3,7 @@ package brooklyn.entity.database.postgresql;
 import brooklyn.entity.chef.ChefConfig;
 import brooklyn.entity.chef.ChefConfig.ChefModes;
 import brooklyn.entity.proxying.EntitySpec;
+import brooklyn.entity.salt.SaltConfig;
 
 /** utiltiy for creating specs for PostgreSql instances */
 public class PostgreSqlSpecs {
@@ -22,6 +23,7 @@ public class PostgreSqlSpecs {
 
     public static EntitySpec<PostgreSqlNode> specSalt() {
         EntitySpec<PostgreSqlNode> spec = EntitySpec.create(PostgreSqlNode.class, PostgreSqlNodeSaltImpl.class);
+        spec.configure(SaltConfig.MASTERLESS_MODE, true);
         return spec;
     }
 }


Mime
View raw message