diff options
Diffstat (limited to 'tosca2heat/tosca-parser')
4 files changed, 8 insertions, 10 deletions
diff --git a/tosca2heat/tosca-parser/toscaparser/nodetemplate.py b/tosca2heat/tosca-parser/toscaparser/nodetemplate.py index d90b73a..10eae33 100644 --- a/tosca2heat/tosca-parser/toscaparser/nodetemplate.py +++ b/tosca2heat/tosca-parser/toscaparser/nodetemplate.py @@ -48,7 +48,7 @@ class NodeTemplate(EntityTemplate): self.available_rel_tpls = available_rel_tpls self.available_rel_types = available_rel_types self._relationships = {} - self.substitution_mapped = False + self.substitution_mapped = None @property def relationships(self): diff --git a/tosca2heat/tosca-parser/toscaparser/substitution_mappings.py b/tosca2heat/tosca-parser/toscaparser/substitution_mappings.py index dc953b0..20ec947 100644 --- a/tosca2heat/tosca-parser/toscaparser/substitution_mappings.py +++ b/tosca2heat/tosca-parser/toscaparser/substitution_mappings.py @@ -53,8 +53,6 @@ class Substitution_mappings(object): self._capabilities = None self._requirements = None - self.sub_mapped_node_template.substitution_mapped = True - @classmethod def get_node_type(cls, sub_mapping_def): if isinstance(sub_mapping_def, dict): diff --git a/tosca2heat/tosca-parser/toscaparser/tests/test_topology_template.py b/tosca2heat/tosca-parser/toscaparser/tests/test_topology_template.py index 3d1b55d..6e3eb62 100644 --- a/tosca2heat/tosca-parser/toscaparser/tests/test_topology_template.py +++ b/tosca2heat/tosca-parser/toscaparser/tests/test_topology_template.py @@ -161,4 +161,4 @@ class TopologyTemplateTest(TestCase): self.assertIsNotNone(system_tosca_template) self.assertEqual( len(system_tosca_template. - nested_tosca_templates_with_topology), 3) + nested_tosca_templates_with_topology), 4) diff --git a/tosca2heat/tosca-parser/toscaparser/tosca_template.py b/tosca2heat/tosca-parser/toscaparser/tosca_template.py index 28fa57b..80cb1cb 100644 --- a/tosca2heat/tosca-parser/toscaparser/tosca_template.py +++ b/tosca2heat/tosca-parser/toscaparser/tosca_template.py @@ -231,12 +231,12 @@ class ToscaTemplate(object): yaml_dict_tpl=tosca_tpl, sub_mapped_node_template=nodetemplate) if nested_template.has_substitution_mappings(): - fnames = \ - [tpl.path for tpl in - self.nested_tosca_templates_with_topology] - if fname not in fnames: - self.nested_tosca_templates_with_topology.\ - append(nested_template) + # Record the nested templates in top level template + self.nested_tosca_templates_with_topology.\ + append(nested_template) + # Set the substitution toscatemplate for mapped node + nodetemplate.sub_mapping_tosca_template = \ + nested_template def _validate_field(self): version = self._tpl_version() |