summaryrefslogtreecommitdiffstats
path: root/tosca2heat/tosca-parser/toscaparser/elements/nodetype.py
diff options
context:
space:
mode:
Diffstat (limited to 'tosca2heat/tosca-parser/toscaparser/elements/nodetype.py')
-rw-r--r--tosca2heat/tosca-parser/toscaparser/elements/nodetype.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/tosca2heat/tosca-parser/toscaparser/elements/nodetype.py b/tosca2heat/tosca-parser/toscaparser/elements/nodetype.py
index 7d68c0b..7f3da2d 100644
--- a/tosca2heat/tosca-parser/toscaparser/elements/nodetype.py
+++ b/tosca2heat/tosca-parser/toscaparser/elements/nodetype.py
@@ -82,8 +82,9 @@ class NodeType(StatefulEntityType):
if isinstance(value, dict):
captype = value['capability']
value = (self.
- _get_node_type_by_cap(key, captype))
- relation = self._get_relation(key, value)
+ _get_node_type_by_cap(captype))
+ # _get_node_type_by_cap(key, captype))
+ # relation = self._get_relation(key, value)
keyword = key
node_type = value
rtype = RelationshipType(relation, keyword, self.custom_def)
@@ -91,7 +92,7 @@ class NodeType(StatefulEntityType):
relationship[rtype] = relatednode
return relationship
- def _get_node_type_by_cap(self, key, cap):
+ def _get_node_type_by_cap(self, cap):
'''Find the node type that has the provided capability
This method will lookup all node types if they have the
@@ -102,9 +103,15 @@ class NodeType(StatefulEntityType):
node_types = [node_type for node_type in self.TOSCA_DEF.keys()
if node_type.startswith(self.NODE_PREFIX) and
node_type != 'tosca.nodes.Root']
-
- for node_type in node_types:
- node_def = self.TOSCA_DEF[node_type]
+ custom_node_types = [node_type for node_type in self.custom_def.keys()
+ if node_type.startswith(self.NODE_PREFIX) and
+ node_type != 'tosca.nodes.Root']
+
+ for node_type in node_types + custom_node_types:
+ if node_type in self.TOSCA_DEF:
+ node_def = self.TOSCA_DEF[node_type]
+ else:
+ node_def = self.custom_def[node_type]
if isinstance(node_def, dict) and 'capabilities' in node_def:
node_caps = node_def['capabilities']
for value in node_caps.values():
@@ -114,7 +121,7 @@ class NodeType(StatefulEntityType):
def _get_relation(self, key, ndtype):
relation = None
- ntype = NodeType(ndtype)
+ ntype = NodeType(ndtype, self.custom_def)
caps = ntype.get_capabilities()
if caps and key in caps.keys():
c = caps[key]