summaryrefslogtreecommitdiffstats
path: root/tosca2heat
diff options
context:
space:
mode:
Diffstat (limited to 'tosca2heat')
-rw-r--r--tosca2heat/tosca-parser/toscaparser/elements/capabilitytype.py2
-rw-r--r--tosca2heat/tosca-parser/toscaparser/tests/test_properties.py29
2 files changed, 30 insertions, 1 deletions
diff --git a/tosca2heat/tosca-parser/toscaparser/elements/capabilitytype.py b/tosca2heat/tosca-parser/toscaparser/elements/capabilitytype.py
index 23c5afc..c37aa9d 100644
--- a/tosca2heat/tosca-parser/toscaparser/elements/capabilitytype.py
+++ b/tosca2heat/tosca-parser/toscaparser/elements/capabilitytype.py
@@ -35,7 +35,7 @@ class CapabilityTypeDef(StatefulEntityType):
parent_properties = {}
if self.parent_capabilities:
for type, value in self.parent_capabilities.items():
- parent_properties[type] = value.get('properties')
+ parent_properties[type] = value.get('properties', {})
if self.properties:
for prop, schema in self.properties.items():
properties.append(PropertyDef(prop, None, schema))
diff --git a/tosca2heat/tosca-parser/toscaparser/tests/test_properties.py b/tosca2heat/tosca-parser/toscaparser/tests/test_properties.py
index 6b95537..faa8af4 100644
--- a/tosca2heat/tosca-parser/toscaparser/tests/test_properties.py
+++ b/tosca2heat/tosca-parser/toscaparser/tests/test_properties.py
@@ -314,6 +314,31 @@ class PropertyTest(TestCase):
num_cpus: 1
'''
+ tosca_custom_def_example3 = '''
+ tosca.capabilities.New:
+ derived_from: tosca.capabilities.Node
+ properties:
+ test_case:
+ type: integer
+ required: yes
+
+ tosca.nodes.ComputeNew:
+ derived_from: tosca.nodes.Compute
+ capabilities:
+ scalable:
+ type: tosca.capabilities.New
+ '''
+
+ tosca_node_template_example3 = '''
+ node_templates:
+ compute_instance:
+ type: tosca.nodes.ComputeNew
+ capabilities:
+ scalable:
+ properties:
+ test_case: 1
+ '''
+
tpl1 = self._get_nodetemplate(tosca_node_template_example1,
tosca_custom_def_example1)
self.assertIsNone(tpl1.validate())
@@ -322,6 +347,10 @@ class PropertyTest(TestCase):
tosca_custom_def_example2)
self.assertIsNone(tpl2.validate())
+ tpl3 = self._get_nodetemplate(tosca_node_template_example3,
+ tosca_custom_def_example3)
+ self.assertIsNone(tpl3.validate())
+
def _get_nodetemplate(self, tpl_snippet,
custom_def_snippet=None):
nodetemplates = yamlparser.\