Check tosca node requirements
Befor iterating over tosca node requirement makes sure that it is provided. Change-Id: Iecba38b8344ce57f43a7fb34e50b3ca1fd606eb5 Closes-Bug: #1358812
This commit is contained in:
parent
853fb5c2b6
commit
650ee38a6b
@ -67,7 +67,7 @@ class TranslateNodeTemplates():
|
||||
hot_resources = []
|
||||
hot_lookup = {}
|
||||
|
||||
attachment_suffix = 0
|
||||
suffix = 0
|
||||
# Copy the TOSCA graph: nodetemplate
|
||||
for node in self.nodetemplates:
|
||||
hot_node = TOSCA_TO_HOT_TYPE[node.type](node)
|
||||
@ -78,20 +78,21 @@ class TranslateNodeTemplates():
|
||||
# which doesn't match to Heat Resources 1 to 1.
|
||||
if node.type == "tosca.nodes.Compute":
|
||||
volume_name = None
|
||||
reuirements = node.requirements
|
||||
requirements = node.requirements
|
||||
if requirements:
|
||||
# Find the name of associated BlockStorage node
|
||||
for requires in reuirements:
|
||||
for value in requires.values():
|
||||
for n in self.nodetemplates:
|
||||
if n.name == value:
|
||||
volume_name = value
|
||||
break
|
||||
attachment_suffix = attachment_suffix + 1
|
||||
attachment_node = self._get_attachment_node(node,
|
||||
attachment_suffix,
|
||||
volume_name)
|
||||
if attachment_node:
|
||||
hot_resources.append(attachment_node)
|
||||
for requires in requirements:
|
||||
for value in requires.values():
|
||||
for n in self.nodetemplates:
|
||||
if n.name == value:
|
||||
volume_name = value
|
||||
break
|
||||
suffix = suffix + 1
|
||||
attachment_node = self._get_attachment_node(node,
|
||||
suffix,
|
||||
volume_name)
|
||||
if attachment_node:
|
||||
hot_resources.append(attachment_node)
|
||||
|
||||
# Handle life cycle operations: this may expand each node
|
||||
# into multiple HOT resources and may change their name
|
||||
|
@ -54,7 +54,7 @@ class NodeTemplate(EntityTemplate):
|
||||
def related_nodes(self):
|
||||
if not self.related:
|
||||
for relation, node in self.type_definition.relationship.items():
|
||||
for tpl in self.node_templates:
|
||||
for tpl in self.templates:
|
||||
if tpl == node.type:
|
||||
self.related[NodeTemplate(tpl)] = relation
|
||||
return self.related.keys()
|
||||
@ -69,7 +69,7 @@ class NodeTemplate(EntityTemplate):
|
||||
name = node
|
||||
break
|
||||
if name:
|
||||
tpl = NodeTemplate(name, self.node_templates)
|
||||
tpl = NodeTemplate(name, self.templates)
|
||||
caps = tpl.capabilities
|
||||
for c in caps:
|
||||
if c.name == cap_name:
|
||||
|
Loading…
Reference in New Issue
Block a user