allow template to specify site display name
diff --git a/xos/tosca/custom_types/xos.yaml b/xos/tosca/custom_types/xos.yaml
index 850315d..b93f497 100644
--- a/xos/tosca/custom_types/xos.yaml
+++ b/xos/tosca/custom_types/xos.yaml
@@ -32,6 +32,11 @@
capabilities:
site:
type: tosca.capabilities.xos.Site
+ properties:
+ display_name:
+ type: string
+ required: false
+ description: name of the site
tosca.nodes.Slice:
derived_from: tosca.nodes.Root
diff --git a/xos/tosca/resources/xosresource.py b/xos/tosca/resources/xosresource.py
index 04ee4aa..756aaf8 100644
--- a/xos/tosca/resources/xosresource.py
+++ b/xos/tosca/resources/xosresource.py
@@ -48,6 +48,9 @@
else:
return {}
+ def get_property(self, name):
+ return self.nodetemplate.get_property_value(name)
+
def get_xos_object(self, cls, **kwargs):
objs = cls.objects.filter(**kwargs)
if not objs:
diff --git a/xos/tosca/resources/xossite.py b/xos/tosca/resources/xossite.py
index 7ad5cee..b4f33a6 100644
--- a/xos/tosca/resources/xossite.py
+++ b/xos/tosca/resources/xossite.py
@@ -17,15 +17,17 @@
xos_model = Site
def get_xos_args(self):
+ display_name = self.get_property("display_name")
+ if not display_name:
+ display_name = nodetemplate.name
+
args = {"login_base": self.nodetemplate.name,
- "name": self.nodetemplate.name}
-
- #deployment_name = self.get_requirement("tosca.relationships.SiteDeployment")
- #if deployment_name:
- # args["deployment"] = self.get_xos_object(Deployment, name=deployment_name)
-
+ "name": display_name}
return args
+ def get_existing_objs(self):
+ return self.xos_model.objects.filter(login_base = self.nodetemplate.name)
+
def postprocess(self, obj):
results = []
for reqs in self.nodetemplate.requirements:
diff --git a/xos/tosca/samples/new_site_deploy_slice.yaml b/xos/tosca/samples/new_site_deploy_slice.yaml
index 0d2f206..66f83d3 100644
--- a/xos/tosca/samples/new_site_deploy_slice.yaml
+++ b/xos/tosca/samples/new_site_deploy_slice.yaml
@@ -19,6 +19,8 @@
newsite:
type: tosca.nodes.Site
+ properties:
+ display_name: some new site
requirements:
- deployment:
node: newdeployment