blob: 2a6e6d46f517f6b70b1720c7ab7b5f591b01e4a7 [file] [log] [blame]
Saleil Bhat45419542017-01-06 15:25:57 -08001from services.vmme.models import VMMETenant, VMMEService
2from xosresource import XOSResource
3
4class XOSVMMETenant(XOSResource):
5 provides = "tosca.nodes.VMMETenant"
6 xos_model = VMMETenant
Saleil Bhatf57ebfd2017-01-21 23:10:09 -08007 copyin_props = ["tenant_message", "image_name"]
8 name_field = None
Saleil Bhat45419542017-01-06 15:25:57 -08009
10 def get_xos_args(self, throw_exception=True):
11 args = super(XOSVMMETenant, self).get_xos_args()
12
13 provider_name = self.get_requirement("tosca.relationships.MemberOfService", throw_exception=throw_exception)
14 if provider_name:
15 args["provider_service"] = self.get_xos_object(VMMEService, throw_exception=throw_exception, name=provider_name)
16
17 return args
18
19 def get_existing_objs(self):
20 args = self.get_xos_args(throw_exception=False)
21 provider_service = args.get("provider", None)
22 if provider_service:
23 return [ self.get_xos_object(provider_service=provider_service) ]
24 return []
25
26 def postprocess(self, obj):
27 pass
28
29 def can_delete(self, obj):
30 return super(XOSVMMETenant, self).can_delete(obj)