do not destroy deployment if nodes are attached
diff --git a/xos/tosca/resources/deployment.py b/xos/tosca/resources/deployment.py
index 152b1f9..ed6734c 100644
--- a/xos/tosca/resources/deployment.py
+++ b/xos/tosca/resources/deployment.py
@@ -51,13 +51,13 @@
self.postprocess_privileges(DeploymentRole, DeploymentPrivilege, rolemap, obj, "deployment")
def delete(self, obj):
- if self.get_property("no-delete"):
- self.info("Deployment %s is marked no-delete")
- return
-
if obj.sites.exists():
self.info("Deployment %s has active sites; skipping delete" % obj.name)
return
+ for sd in obj.sitedeployments.all():
+ if sd.nodes.exists():
+ self.info("Deployment %s has active nodes; skipping delete" % obj.name)
+ return
#if obj.nodes.exists():
# self.info("Deployment %s has active nodes; skipping delete" % obj.name)
# return