blob: f46dfd2014b8b1e8b8d660835f60ab1126aa123e [file] [log] [blame]
Scott Bakercae42412015-08-05 18:23:40 -07001# note: this module named xossite.py instead of site.py due to conflict with
2# /usr/lib/python2.7/site.py
3
4import os
5import pdb
6import sys
7import tempfile
8sys.path.append("/opt/tosca")
9from translator.toscalib.tosca_template import ToscaTemplate
10
11from core.models import User,Deployment
12
13from xosresource import XOSResource
14
15class XOSDeployment(XOSResource):
16 provides = "tosca.nodes.Deployment"
17 xos_model = Deployment
Scott Bakerab498962015-09-22 17:26:31 -070018 copyin_props = ["accessControl"]
Scott Bakercae42412015-08-05 18:23:40 -070019
20 def get_xos_args(self):
Scott Bakerab498962015-09-22 17:26:31 -070021 args = super(XOSDeployment, self).get_xos_args()
Scott Bakercae42412015-08-05 18:23:40 -070022
23 return args
24
25 def create(self):
26 xos_args = self.get_xos_args()
27
28 slice = Deployment(**xos_args)
29 slice.caller = self.user
30 slice.save()
31
32 self.info("Created Deployment '%s'" % (str(slice), ))
33
34 def delete(self, obj):
35 if obj.sites.exists():
36 self.info("Deployment %s has active sites; skipping delete" % obj.name)
37 return
38 #if obj.nodes.exists():
39 # self.info("Deployment %s has active nodes; skipping delete" % obj.name)
40 # return
41 super(XOSDeployment, self).delete(obj)
42
43
44