brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [09/50] git commit: don't promote yaml apps which define initializers and brooklyn.config at the root
Date Wed, 09 Jul 2014 21:46:22 GMT
don't promote yaml apps which define initializers and brooklyn.config at the root


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

Branch: refs/heads/master
Commit: 79e5cd9a3f317bf20910ea1366b7800ceeda53fa
Parents: e8f0371
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Fri Jul 4 14:15:14 2014 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Wed Jul 9 22:34:42 2014 +0100

----------------------------------------------------------------------
 .../BrooklynAssemblyTemplateInstantiator.java   | 21 ++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/79e5cd9a/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java
b/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java
index a1bc769..e1c82bf 100644
--- a/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java
+++ b/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java
@@ -28,6 +28,7 @@ import java.lang.reflect.Constructor;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -296,10 +297,6 @@ public class BrooklynAssemblyTemplateInstantiator implements AssemblyTemplateSpe
             // (normally this will be done by the resolveSpec call above)
             if (app.getDisplayName()==null) app.displayName(oldApp.getDisplayName());
             app.locations(oldApp.getLocations());
-            app.configure(app.getConfig());
-            app.addInitializers(oldApp.getInitializers());
-            // TODO other things, as they are added (or refuse to promote if they are set)
-            // (it's a bit messy doing this copy)
         }
         
         return app;
@@ -319,6 +316,22 @@ public class BrooklynAssemblyTemplateInstantiator implements AssemblyTemplateSpe
         if (childSpec.getType()==null || !Application.class.isAssignableFrom(childSpec.getType()))
             return false;
 
+        Set<String> rootAttrs = template.getCustomAttributes().keySet();
+        for (String rootAttr: rootAttrs) {
+            if (rootAttr.equals("brooklyn.catalog")) {
+                // this attr does not block promotion
+                continue;
+            }
+            if (rootAttr.startsWith("brooklyn.")) {
+                // any others in 'brooklyn' namespace will block promotion
+                return false;
+            }
+            // location is allowed in both, and is copied on promotion
+            // (name also copied)
+            // others are root currently are ignored on promotion; they are usually metadata
+            // TODO might be nice to know what we are excluding
+        }
+        
         return true;
     }
 


Mime
View raw message