From 6b4ad25ad60a6e7f508142fe7e0656da349eb556 Mon Sep 17 00:00:00 2001 From: shangxdy Date: Wed, 15 Jun 2016 23:24:44 +0800 Subject: [PATCH] Incorrect inheritance of requirements in NodeType 1. When define a new NodeType that inherits from a normative type that has some requirements, and if the reqirement item name is same as parent's, there will be duplicated requirements, not override the parent's item. 2. The bug will submit to openstack community. Change-Id: I22f6e723179a8a8c334d37c1a69b7039dc1f6ae7 JIRA: PARSER-56 Signed-off-by: shangxdy --- tosca2heat/tosca-parser/toscaparser/elements/entity_type.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tosca2heat/tosca-parser/toscaparser/elements/entity_type.py b/tosca2heat/tosca-parser/toscaparser/elements/entity_type.py index 5d620a5..72e7e3f 100644 --- a/tosca2heat/tosca-parser/toscaparser/elements/entity_type.py +++ b/tosca2heat/tosca-parser/toscaparser/elements/entity_type.py @@ -106,8 +106,13 @@ class EntityType(object): value[k] = v if isinstance(value, list): for p_value in parent_value: - if p_value not in value: - value.append(p_value) + if isinstance(p_value, dict): + if p_value.keys()[0] not in [ + item.keys()[0] for item in value]: + value.append(p_value) + else: + if p_value not in value: + value.append(p_value) else: value = copy.copy(parent_value) p = p.parent_type -- 2.16.6