Scott Baker | 8f32cc8 | 2016-08-08 10:34:53 -0700 | [diff] [blame] | 1 | import os |
| 2 | import pdb |
| 3 | import sys |
| 4 | import tempfile |
| 5 | sys.path.append("/opt/tosca") |
| 6 | from translator.toscalib.tosca_template import ToscaTemplate |
| 7 | |
| 8 | from services.hpc.models import CDNPrefix, ContentProvider |
| 9 | |
| 10 | from xosresource import XOSResource |
| 11 | |
| 12 | class XOSCDNPrefix(XOSResource): |
| 13 | provides = "tosca.nodes.CDNPrefix" |
| 14 | xos_model = CDNPrefix |
| 15 | name_field = "prefix" |
| 16 | copyin_props = [] |
| 17 | |
| 18 | def get_xos_args(self): |
| 19 | args = {"prefix": self.obj_name} |
| 20 | |
| 21 | cp_name = self.get_requirement("tosca.relationships.MemberOfContentProvider") |
| 22 | if cp_name: |
| 23 | args["contentProvider"] = self.get_xos_object(ContentProvider, name=cp_name) |
| 24 | |
| 25 | default_os = self.get_requirement("tosca.relationships.DefaultOriginServer") |
| 26 | if default_os: |
| 27 | args["defaultOriginServer"] = self.engine.name_to_xos_model(self.user, default_os) |
| 28 | |
| 29 | return args |
| 30 | |
| 31 | def can_delete(self, obj): |
| 32 | return super(XOSCDNPrefix, self).can_delete(obj) |
| 33 | |