blob: 3a5914c6d3845ecbcfc6af22299d3fa39578903b [file] [log] [blame]
Scott Baker31acc652016-06-23 15:47:56 -07001import os
2import pdb
3import sys
4import tempfile
5sys.path.append("/opt/tosca")
6from translator.toscalib.tosca_template import ToscaTemplate
7import pdb
8
Srikanth Vavilapallid84b7b72016-06-28 00:19:07 +00009from services.monitoring.models import MonitoringChannel, CeilometerService
Scott Baker31acc652016-06-23 15:47:56 -070010
11from xosresource import XOSResource
12
13class XOSCeilometerTenant(XOSResource):
14 provides = "tosca.nodes.CeilometerTenant"
15 xos_model = MonitoringChannel
16 name_field = None
17
18 def get_xos_args(self, throw_exception=True):
19 args = super(XOSCeilometerTenant, self).get_xos_args()
20
21 provider_name = self.get_requirement("tosca.relationships.MemberOfService", throw_exception=throw_exception)
22 if provider_name:
23 args["provider_service"] = self.get_xos_object(CeilometerService, throw_exception=throw_exception, name=provider_name)
24
25 return args
26
27 def get_existing_objs(self):
28 args = self.get_xos_args(throw_exception=False)
29 provider_service = args.get("provider", None)
30 if provider_service:
31 return [ self.get_xos_object(provider_service=provider_service) ]
32 return []
33
34 def postprocess(self, obj):
35 pass
36
37 def can_delete(self, obj):
38 return super(XOSCeilometerTenant, self).can_delete(obj)
39