diff options
-rw-r--r-- | docs/release/userguide/feature.userguide.rst | 2 | ||||
-rw-r--r-- | tosca2heat/tosca-parser/toscaparser/elements/capabilitytype.py | 2 | ||||
-rw-r--r-- | tosca2heat/tosca-parser/toscaparser/tests/test_properties.py | 29 | ||||
-rw-r--r-- | tox.ini | 2 |
4 files changed, 33 insertions, 2 deletions
diff --git a/docs/release/userguide/feature.userguide.rst b/docs/release/userguide/feature.userguide.rst index 4d0d46e..4ad4f22 100644 --- a/docs/release/userguide/feature.userguide.rst +++ b/docs/release/userguide/feature.userguide.rst @@ -71,7 +71,7 @@ Using api, which is used to parse and get the result of service template. it can ToscaTemplate(path=None, parsed_params=None, a_file=True, yaml_dict_tpl=None, sub_mapped_node_template=None, - no_required_paras_valid=False, debug=False ) + no_required_paras_valid=False, debug=False) REST API ********* 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.\ @@ -25,10 +25,12 @@ commands = bash -c 'cd tosca2heat/tosca-parser; tox' [testenv:docs] +usedevelop = False deps = -rdocs/requirements.txt commands = sphinx-build -b html -n -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/html [testenv:docs-linkcheck] +usedevelop = False deps = -rdocs/requirements.txt commands = sphinx-build -b linkcheck -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/linkcheck |