From 68cd5714afa7f4d903c2d52bbb8f2a3dc4118f61 Mon Sep 17 00:00:00 2001 From: shangxdy Date: Sun, 15 May 2016 14:52:29 -0400 Subject: bugs:The code in function of get_all_requirements is duplicated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1、The virtualLink requirement of tosca.nodes.nfv.CP defined below: In nodetype.py, the most code in functon of get_all_requirements is not needed,becuase the property of requirements has realized the main logical in current get_all_requirements. So the duplicated code will be deleted. 2、The bug will be submitted to openstack community. JIRA: PARSER-37 Change-Id: I1a346ffc388546dd9c65a1b8d32e32859150d077 Signed-off-by: shangxdy --- .../tosca-parser/toscaparser/elements/nodetype.py | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'tosca2heat') diff --git a/tosca2heat/tosca-parser/toscaparser/elements/nodetype.py b/tosca2heat/tosca-parser/toscaparser/elements/nodetype.py index 8176def..148d2b6 100644 --- a/tosca2heat/tosca-parser/toscaparser/elements/nodetype.py +++ b/tosca2heat/tosca-parser/toscaparser/elements/nodetype.py @@ -12,7 +12,6 @@ from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import UnknownFieldError -from toscaparser.common.exception import ValidationError from toscaparser.elements.capabilitytype import CapabilityTypeDef import toscaparser.elements.interfaces as ifaces from toscaparser.elements.interfaces import InterfacesDef @@ -160,24 +159,7 @@ class NodeType(StatefulEntityType): return self.get_value(self.REQUIREMENTS, None, True) def get_all_requirements(self): - requires = self.requirements - parent_node = self.parent_type - if requires is None: - requires = self.get_value(self.REQUIREMENTS, None, True) - if parent_node is None: - ExceptionCollector.appendException( - ValidationError(message="parent_node is " - + str(parent_node))) - else: - parent_node = parent_node.parent_type - if parent_node: - while parent_node.type != 'tosca.nodes.Root': - req = parent_node.get_value(self.REQUIREMENTS, None, True) - for r in req: - if r not in requires: - requires.append(r) - parent_node = parent_node.parent_type - return requires + return self.requirements @property def interfaces(self): -- cgit 1.2.3-korg