try harder to find requirements of requirements
diff --git a/xos/tosca/engine.py b/xos/tosca/engine.py
index 0801c9b..efe64e2 100644
--- a/xos/tosca/engine.py
+++ b/xos/tosca/engine.py
@@ -32,6 +32,7 @@
self.ordered_nodetemplates = []
self.ordered_names = self.topsort_dependencies()
+ print "ordered_names", self.ordered_names
for name in self.ordered_names:
if name in self.nodetemplates_by_name:
self.ordered_nodetemplates.append(self.nodetemplates_by_name[name])
@@ -55,6 +56,15 @@
nodetemplate.dependencies.append(nodetemplates_by_name[name])
nodetemplate.dependencies_names.append(name)
+ # go another level deep, as our requirements can have requirements...
+ for sd_req in v.get("requirements",[]):
+ for (sd_req_k, sd_req_v) in sd_req.items():
+ name = sd_req_v["node"]
+ if (name in nodetemplates_by_name):
+ nodetemplate.dependencies.append(nodetemplates_by_name[name])
+ nodetemplate.dependencies_names.append(name)
+
+
def topsort_dependencies(self):
# stolen from observer
g = self.nodetemplates_by_name
@@ -111,7 +121,7 @@
def execute_nodetemplate(self, user, nodetemplate):
if nodetemplate.type in resources.resources:
cls = resources.resources[nodetemplate.type]
- #print "work on", cls.__name__, nodetemplate.name
+ print "work on", cls.__name__, nodetemplate.name
obj = cls(user, nodetemplate)
obj.create_or_update()