Scott Baker | 8f32cc8 | 2016-08-08 10:34:53 -0700 | [diff] [blame] | 1 | import importlib |
| 2 | import os |
| 3 | import pdb |
| 4 | import sys |
| 5 | import tempfile |
| 6 | sys.path.append("/opt/tosca") |
| 7 | from translator.toscalib.tosca_template import ToscaTemplate |
| 8 | import pdb |
| 9 | |
| 10 | from services.hpc.models import HpcHealthCheck, HpcService |
| 11 | |
| 12 | from xosresource import XOSResource |
| 13 | |
| 14 | class XOSHpcHealthCheck(XOSResource): |
| 15 | provides = "tosca.nodes.HpcHealthCheck" |
| 16 | xos_model = HpcHealthCheck |
| 17 | name_field = None |
| 18 | copyin_props = ("kind", "resource_name", "result_contains") |
| 19 | |
| 20 | def get_xos_args(self, throw_exception=True): |
| 21 | args = super(XOSHpcHealthCheck, self).get_xos_args() |
| 22 | |
| 23 | service_name = self.get_requirement("tosca.relationships.MemberOfService", throw_exception=throw_exception) |
| 24 | if service_name: |
| 25 | args["hpcService"] = self.get_xos_object(HpcService, throw_exception=throw_exception, name=service_name) |
| 26 | |
| 27 | return args |
| 28 | |
| 29 | def get_existing_objs(self): |
| 30 | args = self.get_xos_args(throw_exception=True) |
| 31 | |
| 32 | return list( HpcHealthCheck.objects.filter(hpcService=args["hpcService"], kind=args["kind"], resource_name=args["resource_name"]) ) |
| 33 | |
| 34 | def postprocess(self, obj): |
| 35 | pass |
| 36 | |
| 37 | def can_delete(self, obj): |
| 38 | return super(XOSTenant, self).can_delete(obj) |
| 39 | |