Merge branch 'master' of github.com:open-cloud/xos
diff --git a/xos/tosca/resources/node.py b/xos/tosca/resources/node.py
index b7f426d..99e756f 100644
--- a/xos/tosca/resources/node.py
+++ b/xos/tosca/resources/node.py
@@ -30,13 +30,18 @@
siteDeployment = self.get_xos_object(SiteDeployment, site=site, deployment=deployment, throw_exception=True)
args["site_deployment"] = siteDeployment
+ return args
+
+ def postprocess(self, obj):
+ # We can't set the labels when we create a Node, because they're
+ # ManyToMany related, and the node doesn't exist yet.
labels=[]
for label_name in self.get_requirements("tosca.relationships.HasLabel"):
labels.append(self.get_xos_object(NodeLabel, name=label_name))
if labels:
- args["labels"] = labels
-
- return args
+ self.info("Updated labels for node '%s'" % obj)
+ obj.labels = labels
+ obj.save()
def create(self):
nodetemplate = self.nodetemplate