onboard the tosca resources for exampleservice
diff --git a/xos/onboard/exampleservice/exampleservice-onboard.yaml b/xos/onboard/exampleservice/exampleservice-onboard.yaml
index 91dbb2e..9999a38 100644
--- a/xos/onboard/exampleservice/exampleservice-onboard.yaml
+++ b/xos/onboard/exampleservice/exampleservice-onboard.yaml
@@ -17,6 +17,7 @@
admin: admin.py
synchronizer: synchronizer/manifest
tosca_custom_types: exampleservice.yaml
+ tosca_resource: tosca/resources/exampleservice.py, tosca/resources/exampletenant.py
rest_service: api/service/exampleservice.py
rest_tenant: api/tenant/exampletenant.py
private_key: file:///opt/xos/key_import/exampleservice_rsa
diff --git a/xos/tosca/custom_types/xos.m4 b/xos/tosca/custom_types/xos.m4
index 9497b6d..9e6cb41 100644
--- a/xos/tosca/custom_types/xos.m4
+++ b/xos/tosca/custom_types/xos.m4
@@ -80,6 +80,10 @@
type: string
required: false
description: url of tosca custom_types
+ tosca_resource:
+ type: string
+ required: false
+ description: url of tosca resource
rest_service:
type: string
required: false
diff --git a/xos/tosca/custom_types/xos.yaml b/xos/tosca/custom_types/xos.yaml
index 66229d5..0888c53 100644
--- a/xos/tosca/custom_types/xos.yaml
+++ b/xos/tosca/custom_types/xos.yaml
@@ -188,6 +188,10 @@
type: string
required: false
description: url of tosca custom_types
+ tosca_resource:
+ type: string
+ required: false
+ description: url of tosca resource
rest_service:
type: string
required: false
diff --git a/xos/tosca/resources/servicecontroller.py b/xos/tosca/resources/servicecontroller.py
index 34b95c2..d821b56 100644
--- a/xos/tosca/resources/servicecontroller.py
+++ b/xos/tosca/resources/servicecontroller.py
@@ -15,25 +15,33 @@
copyin_props = ["base_url"]
def postprocess_resource_prop(self, obj, kind, format):
- value = self.get_property(kind)
- if value:
- scr = ServiceControllerResource.objects.filter(service_controller=obj, kind=kind, format=format)
- if scr:
- scr=scr[0]
- if scr.url != value:
- self.info("updating resource %s" % kind)
- scr.url = value
+ values = self.get_property(kind)
+ if values:
+ for i,value in enumerate(values.split(",")):
+ value = value.strip()
+
+ name=kind
+ if i>0:
+ name = "%s_%d" %( name, i)
+
+ scr = ServiceControllerResource.objects.filter(service_controller=obj, name=name, kind=kind, format=format)
+ if scr:
+ scr=scr[0]
+ if scr.url != value:
+ self.info("updating resource %s" % kind)
+ scr.url = value
+ scr.save()
+ else:
+ self.info("adding resource %s" % kind)
+ scr = ServiceControllerResource(service_controller=obj, name=name, kind=kind, format=format, url=value)
scr.save()
- else:
- self.info("adding resource %s" % kind)
- scr = ServiceControllerResource(service_controller=obj, name=kind, kind=kind, format=format, url=value)
- scr.save()
def postprocess(self, obj):
# allow these common resource to be specified directly by the ServiceController tosca object
self.postprocess_resource_prop(obj, "models", "python")
self.postprocess_resource_prop(obj, "admin", "python")
self.postprocess_resource_prop(obj, "tosca_custom_types", "yaml")
+ self.postprocess_resource_prop(obj, "tosca_resource", "python")
self.postprocess_resource_prop(obj, "synchronizer", "manifest")
self.postprocess_resource_prop(obj, "private_key", "raw")
self.postprocess_resource_prop(obj, "public_key", "raw")