diff options
author | shangxdy <shang.xiaodong@zte.com.cn> | 2017-02-26 00:49:42 +0800 |
---|---|---|
committer | shangxdy <shang.xiaodong@zte.com.cn> | 2017-02-26 00:58:41 +0800 |
commit | 406214e5ca40ad57a1c40e4a8454336f6a26cac2 (patch) | |
tree | c07fa0c0a66716351a367d1959415584fb73bab1 /tosca2heat/tosca-parser/toscaparser/tosca_template.py | |
parent | 0504c523da459a48721fef74216125d83a4e057d (diff) |
Sync upstream code
Sync upstream project of tosca-parser
Change-Id: Ic707844203ea05007b3c02e9dcadb52389eb3149
JIRA:PARSER-118
Signed-off-by: shangxdy <shang.xiaodong@zte.com.cn>
Diffstat (limited to 'tosca2heat/tosca-parser/toscaparser/tosca_template.py')
-rw-r--r-- | tosca2heat/tosca-parser/toscaparser/tosca_template.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/tosca2heat/tosca-parser/toscaparser/tosca_template.py b/tosca2heat/tosca-parser/toscaparser/tosca_template.py index 84d953c..f48078f 100644 --- a/tosca2heat/tosca-parser/toscaparser/tosca_template.py +++ b/tosca2heat/tosca-parser/toscaparser/tosca_template.py @@ -36,14 +36,14 @@ SECTIONS = (DEFINITION_VERSION, DEFAULT_NAMESPACE, TEMPLATE_NAME, TOPOLOGY_TEMPLATE, TEMPLATE_AUTHOR, TEMPLATE_VERSION, DESCRIPTION, IMPORTS, DSL_DEFINITIONS, NODE_TYPES, RELATIONSHIP_TYPES, RELATIONSHIP_TEMPLATES, - CAPABILITY_TYPES, ARTIFACT_TYPES, DATA_TYPES, + CAPABILITY_TYPES, ARTIFACT_TYPES, DATA_TYPES, INTERFACE_TYPES, POLICY_TYPES, GROUP_TYPES, REPOSITORIES) = \ ('tosca_definitions_version', 'tosca_default_namespace', 'template_name', 'topology_template', 'template_author', 'template_version', 'description', 'imports', 'dsl_definitions', 'node_types', 'relationship_types', 'relationship_templates', 'capability_types', 'artifact_types', 'data_types', - 'policy_types', 'group_types', 'repositories') + 'interface_types', 'policy_types', 'group_types', 'repositories') # Sections that are specific to individual template definitions SPECIAL_SECTIONS = (METADATA) = ('metadata') @@ -106,6 +106,7 @@ class ToscaTemplate(object): self.relationship_templates = self._relationship_templates() self.nodetemplates = self._nodetemplates() self.outputs = self._outputs() + self.policies = self._policies() self._handle_nested_tosca_templates_with_topology() self.graph = ToscaGraph(self.nodetemplates) @@ -162,9 +163,12 @@ class ToscaTemplate(object): def _tpl_topology_template(self): return self.tpl.get(TOPOLOGY_TEMPLATE) + def _policies(self): + return self.topology_template.policies + def _get_all_custom_defs(self, imports=None): types = [IMPORTS, NODE_TYPES, CAPABILITY_TYPES, RELATIONSHIP_TYPES, - DATA_TYPES, POLICY_TYPES, GROUP_TYPES] + DATA_TYPES, INTERFACE_TYPES, POLICY_TYPES, GROUP_TYPES] custom_defs_final = {} custom_defs = self._get_custom_types(types, imports) if custom_defs: @@ -196,9 +200,9 @@ class ToscaTemplate(object): imports = self._tpl_imports() if imports: - custom_service = \ - toscaparser.imports.ImportsLoader(imports, self.path, - type_defs, self.tpl) + custom_service = toscaparser.imports.\ + ImportsLoader(imports, self.path, + type_defs, self.tpl) nested_tosca_tpls = custom_service.get_nested_tosca_tpls() self._update_nested_tosca_tpls_with_topology(nested_tosca_tpls) |