Scott Baker | 120976d | 2016-05-26 20:50:58 -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 | |
Scott Baker | 02b6cdb | 2016-06-03 15:49:16 -0700 | [diff] [blame^] | 8 | from core.models import XOS, XOSVolume |
Scott Baker | 120976d | 2016-05-26 20:50:58 -0700 | [diff] [blame] | 9 | |
| 10 | from xosresource import XOSResource |
| 11 | |
| 12 | class XOSXOS(XOSResource): |
| 13 | provides = "tosca.nodes.XOS" |
| 14 | xos_model = XOS |
| 15 | |
Scott Baker | 02b6cdb | 2016-06-03 15:49:16 -0700 | [diff] [blame^] | 16 | class XOSVolume(XOSResource): |
| 17 | provides = "tosca.nodes.XOSVolume" |
| 18 | xos_model = XOSVolume |
| 19 | copyin_props = ["host_path"] |
| 20 | name_field = "container_path" |
Scott Baker | 120976d | 2016-05-26 20:50:58 -0700 | [diff] [blame] | 21 | |
Scott Baker | 02b6cdb | 2016-06-03 15:49:16 -0700 | [diff] [blame^] | 22 | def get_xos_args(self, throw_exception=True): |
| 23 | args = super(XOSVolume, self).get_xos_args() |
Scott Baker | 120976d | 2016-05-26 20:50:58 -0700 | [diff] [blame] | 24 | |
Scott Baker | 02b6cdb | 2016-06-03 15:49:16 -0700 | [diff] [blame^] | 25 | xos_name = self.get_requirement("tosca.relationships.UsedByXOS", throw_exception=throw_exception) |
| 26 | if xos_name: |
| 27 | args["xos"] = self.get_xos_object(XOS, throw_exception=throw_exception, name=xos_name) |
| 28 | |
| 29 | return args |