summaryrefslogtreecommitdiffstats
path: root/tosca2heat/tosca-parser/toscaparser/tosca_template.py
diff options
context:
space:
mode:
Diffstat (limited to 'tosca2heat/tosca-parser/toscaparser/tosca_template.py')
-rw-r--r--tosca2heat/tosca-parser/toscaparser/tosca_template.py29
1 files changed, 23 insertions, 6 deletions
diff --git a/tosca2heat/tosca-parser/toscaparser/tosca_template.py b/tosca2heat/tosca-parser/toscaparser/tosca_template.py
index 3301999..4832bbb 100644
--- a/tosca2heat/tosca-parser/toscaparser/tosca_template.py
+++ b/tosca2heat/tosca-parser/toscaparser/tosca_template.py
@@ -236,12 +236,29 @@ class ToscaTemplate(object):
if self._is_sub_mapped_node(nodetemplate, tosca_tpl):
parsed_params = self._get_params_for_nested_template(
nodetemplate)
- nested_template = ToscaTemplate(
- path=fname, parsed_params=parsed_params,
- yaml_dict_tpl=tosca_tpl,
- sub_mapped_node_template=nodetemplate,
- no_required_paras_valid=self.no_required_paras_valid)
- if nested_template._has_substitution_mappings():
+
+ cache_exeptions = deepcopy(ExceptionCollector.exceptions)
+ cache_exeptions_state = \
+ deepcopy(ExceptionCollector.collecting)
+ nested_template = None
+ try:
+ nrpv = self.no_required_paras_valid
+ nested_template = ToscaTemplate(
+ path=fname, parsed_params=parsed_params,
+ sub_mapped_node_template=nodetemplate,
+ no_required_paras_valid=nrpv)
+ except ValidationError as e:
+ msg = _(' ===== nested service template ===== ')
+ log.error(msg)
+ log.error(e.message)
+ raise e
+
+ ExceptionCollector.exceptions = deepcopy(cache_exeptions)
+ ExceptionCollector.collecting = \
+ deepcopy(cache_exeptions_state)
+
+ if nested_template and \
+ nested_template._has_substitution_mappings():
# Record the nested templates in top level template
self.nested_tosca_templates_with_topology.\
append(nested_template)