From bfdb0cd484dbabda2488d16536612dfe6d818a18 Mon Sep 17 00:00:00 2001 From: shangxdy Date: Sun, 14 Aug 2016 02:35:34 +0800 Subject: [PATCH] Change the name of Substitution_mappings to SubstitutionMappings Change the name of Substitution_mappings to SubstitutionMappings consistent to other classes. JIRA:PARSER-85 Change-Id: I9b27783ccec3f515cfcd2eca9995f09426bbfadd Signed-off-by: shangxdy --- .../tosca-parser/toscaparser/substitution_mappings.py | 16 +++------------- tosca2heat/tosca-parser/toscaparser/topology_template.py | 16 ++++++++-------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/tosca2heat/tosca-parser/toscaparser/substitution_mappings.py b/tosca2heat/tosca-parser/toscaparser/substitution_mappings.py index 7fdce24..83ff590 100644 --- a/tosca2heat/tosca-parser/toscaparser/substitution_mappings.py +++ b/tosca2heat/tosca-parser/toscaparser/substitution_mappings.py @@ -16,22 +16,12 @@ from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import InvalidNodeTypeError from toscaparser.common.exception import MissingRequiredFieldError from toscaparser.common.exception import UnknownFieldError -# from toscaparser.common.exception import ValidationError -# from toscaparser.utils.gettextutils import _ -# from toscaparser.utils import validateutils -# from toscaparser.nodetemplate import NodeTemplate -# from toscaparser.elements.nodetype import NodeType -# from toscaparser.parameters import Input -# from toscaparser.parameters import Output -# from toscaparser.groups import Group -# from toscaparser.policy import Policy - log = logging.getLogger('tosca') -class Substitution_mappings(object): - '''Substitution_mappings class declaration +class SubstitutionMappings(object): + '''SubstitutionMappings class declaration Substitution_mappings exports the topology template as an implementation of a Node type. @@ -111,7 +101,7 @@ class Substitution_mappings(object): for name in inputs_names: if name not in [input.name for input in self.inputs]: ExceptionCollector.appendException( - UnknownFieldError(what='Substitution_mappings', + UnknownFieldError(what='SubstitutionMappings', field=name)) def _validate_capabilities(self): diff --git a/tosca2heat/tosca-parser/toscaparser/topology_template.py b/tosca2heat/tosca-parser/toscaparser/topology_template.py index 0407653..fe05979 100644 --- a/tosca2heat/tosca-parser/toscaparser/topology_template.py +++ b/tosca2heat/tosca-parser/toscaparser/topology_template.py @@ -22,7 +22,7 @@ from toscaparser.parameters import Input from toscaparser.parameters import Output from toscaparser.policy import Policy from toscaparser.relationship_template import RelationshipTemplate -from toscaparser.substitution_mappings import Substitution_mappings +from toscaparser.substitution_mappings import SubstitutionMappings from toscaparser.tpl_relationship_graph import ToscaGraph from toscaparser.utils.gettextutils import _ @@ -111,12 +111,12 @@ class TopologyTemplate(object): def _substitution_mappings(self): tpl_substitution_mapping = self._tpl_substitution_mappings() if tpl_substitution_mapping: - return Substitution_mappings(tpl_substitution_mapping, - self.nodetemplates, - self.inputs, - self.outputs, - self.sub_mapped_node_template, - self.custom_defs) + return SubstitutionMappings(tpl_substitution_mapping, + self.nodetemplates, + self.inputs, + self.outputs, + self.sub_mapped_node_template, + self.custom_defs) def _policies(self): policies = [] @@ -297,4 +297,4 @@ class TopologyTemplate(object): def get_sub_mapping_node_type(cls, topology_tpl): if topology_tpl and isinstance(topology_tpl, dict): submap_tpl = topology_tpl.get(SUBSTITUION_MAPPINGS) - return Substitution_mappings.get_node_type(submap_tpl) + return SubstitutionMappings.get_node_type(submap_tpl) -- 2.16.6