blob: f61ccad93d38f4c0a1b2b76deb7415bca6d8c82e [file] [log] [blame]
Scott Bakered48af12016-04-25 09:21:08 -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, Flavor
12
13from xosresource import XOSResource
14
15class XOSFlavor(XOSResource):
16 provides = "tosca.nodes.Flavor"
17 xos_model = Flavor
18 copyin_props = ["flavor"]
19
20 def get_xos_args(self):
21 args = super(XOSFlavor, self).get_xos_args()
22
23 # Support the default where the OpenStack flavor is the same as the
24 # flavor name
25 if "flavor" not in args:
26 args["flavor"] = args["name"]
27
28 return args
29
30 def delete(self, obj):
31 if obj.instance_set.exists():
32 self.info("Flavor %s has active instances; skipping delete" % obj.name)
33 return
34 super(XOSFlavor, self).delete(obj)
35
36
37