Merge "EntityTemplate has no property of parent_type"
[parser.git] / tosca2heat / tosca-parser / toscaparser / elements / nodetype.py
index 8176def..f5e4eb0 100644 (file)
@@ -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
@@ -99,6 +98,10 @@ class NodeType(StatefulEntityType):
         provided capability.
         '''
 
+        # All types,include normative and custom types, here will
+        # be substituted because the global moification of TOSCA_DEF
+        self.TOSCA_DEF.update(self.custom_def)
+
         # Filter the node types
         node_types = [node_type for node_type in self.TOSCA_DEF.keys()
                       if node_type.startswith(self.NODE_PREFIX) and
@@ -160,24 +163,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):