summaryrefslogtreecommitdiffstats
path: root/tosca2heat/tosca-parser/toscaparser/tosca_template.py
diff options
context:
space:
mode:
authorjulien zhang <zhang.jun3g@zte.com.cn>2016-06-15 08:11:35 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-06-15 08:11:35 +0000
commit3f449b07548e68eaa680b6707be7d9b3bb78b01e (patch)
tree44174cbe13c6ec7a5d8bc1c2bd0b128c797824ee /tosca2heat/tosca-parser/toscaparser/tosca_template.py
parent37c637988622dde3425390fb861800ffdaf2b6cb (diff)
parenta17eab054e89552cfafdad1b0f45d5a613cc2ba6 (diff)
Merge "tosco-parser supports importing the other service with topology template"
Diffstat (limited to 'tosca2heat/tosca-parser/toscaparser/tosca_template.py')
-rw-r--r--tosca2heat/tosca-parser/toscaparser/tosca_template.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/tosca2heat/tosca-parser/toscaparser/tosca_template.py b/tosca2heat/tosca-parser/toscaparser/tosca_template.py
index ba056da..1bad6e9 100644
--- a/tosca2heat/tosca-parser/toscaparser/tosca_template.py
+++ b/tosca2heat/tosca-parser/toscaparser/tosca_template.py
@@ -69,6 +69,7 @@ class ToscaTemplate(object):
self.input_path = None
self.path = None
self.tpl = None
+ self.nested_tosca_template = None
if path:
self.input_path = path
self.path = self._get_path(path)
@@ -177,9 +178,14 @@ class ToscaTemplate(object):
imports = self._tpl_imports()
if imports:
- custom_defs = toscaparser.imports.\
+ custom_service = toscaparser.imports.\
ImportsLoader(imports, self.path,
- type_defs, self.tpl).get_custom_defs()
+ type_defs, self.tpl)
+
+ nested_topo_tpls = custom_service.get_nested_topo_tpls()
+ self._handle_nested_topo_tpls(nested_topo_tpls)
+
+ custom_defs = custom_service.get_custom_defs()
if not custom_defs:
return
@@ -191,6 +197,14 @@ class ToscaTemplate(object):
custom_defs.update(inner_custom_types)
return custom_defs
+ 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)
+
def _validate_field(self):
version = self._tpl_version()
if not version: