From 74924a61a1fefe5e4977cd8d9edf7e5bbbb9f966 Mon Sep 17 00:00:00 2001 From: shangxdy Date: Wed, 29 Jun 2016 16:10:49 +0800 Subject: netsted template validate type error When import nested template, validate type error, in the validate list lack the type of "topology_template" Change-Id: Ic16e02f460dc59936dfc5a361a21b9533f0e5e83 JIRA: PARSER-58 Signed-off-by: shangxdy --- tosca2heat/tosca-parser/toscaparser/tosca_template.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'tosca2heat/tosca-parser/toscaparser/tosca_template.py') diff --git a/tosca2heat/tosca-parser/toscaparser/tosca_template.py b/tosca2heat/tosca-parser/toscaparser/tosca_template.py index 1bad6e9..2ab2581 100644 --- a/tosca2heat/tosca-parser/toscaparser/tosca_template.py +++ b/tosca2heat/tosca-parser/toscaparser/tosca_template.py @@ -69,7 +69,7 @@ class ToscaTemplate(object): self.input_path = None self.path = None self.tpl = None - self.nested_tosca_template = None + self.nested_tosca_template = [] if path: self.input_path = path self.path = self._get_path(path) @@ -199,11 +199,13 @@ class ToscaTemplate(object): def _handle_nested_topo_tpls(self, nested_topo_tpls): for tpl in nested_topo_tpls: - if tpl.get(TOPOLOGY_TEMPLATE): - nested_tosca_template = ToscaTemplate( - path=self.path, parsed_params=self.parsed_params, - yaml_dict_tpl=nested_topo_tpls) - self.nested_tosca_template.apend(nested_tosca_template) + filename, tosca_tpl = tpl.items()[0] + if tosca_tpl.get(TOPOLOGY_TEMPLATE): + nested_template = ToscaTemplate( + path=filename, parsed_params=self.parsed_params, + yaml_dict_tpl=tosca_tpl) + if nested_template.topology_template.substitution_mappings: + self.nested_tosca_template.apend(nested_template) def _validate_field(self): version = self._tpl_version() -- cgit 1.2.3-korg