throw exception if no tosca resource exists for node type
Change-Id: Ic6e264596b2247d807c34c4f41de7e746d1808c8
diff --git a/xos/tosca/engine.py b/xos/tosca/engine.py
index efce829..e3d74c7 100644
--- a/xos/tosca/engine.py
+++ b/xos/tosca/engine.py
@@ -141,12 +141,14 @@
obj.save()
def execute_nodetemplate(self, user, nodetemplate):
- if nodetemplate.type in resources.resources:
- cls = resources.resources[nodetemplate.type]
- #print "work on", cls.__name__, nodetemplate.name
- obj = cls(user, nodetemplate, self)
- obj.create_or_update()
- self.deferred_sync = self.deferred_sync + obj.deferred_sync
+ if nodetemplate.type not in resources.resources:
+ raise Exception("Nodetemplate %s's type %s is not a known resource" % (nodetemplate.name, nodetemplate.type))
+
+ cls = resources.resources[nodetemplate.type]
+ #print "work on", cls.__name__, nodetemplate.name
+ obj = cls(user, nodetemplate, self)
+ obj.create_or_update()
+ self.deferred_sync = self.deferred_sync + obj.deferred_sync
def destroy(self, user):
nodetemplates = self.ordered_nodetemplates