Merge "Fixes few nits in the network features code"

This commit is contained in:
Jenkins
2015-04-15 23:06:03 +00:00
committed by Gerrit Code Review
2 changed files with 14 additions and 3 deletions

View File

@@ -42,6 +42,17 @@ class HotResource(object):
if type == 'OS::Heat::SoftwareConfig': if type == 'OS::Heat::SoftwareConfig':
self.properties['group'] = 'script' self.properties['group'] = 'script'
self.metadata = metadata self.metadata = metadata
# The difference between depends_on and depends_on_nodes is
# that depends_on defines dependency in the context of the
# HOT template and it is used during the template output.
# Depends_on_nodes defines the direct dependency between the
# tosca nodes and is not used during the output of the
# HOT template but for internal processing only. When a tosca
# node depends on another node it will be always added to
# depends_on_nodes but not always to depends_on. For example
# if the source of dependency is a server, the dependency will
# be added as properties.get_resource and not depends_on
if depends_on: if depends_on:
self.depends_on = depends_on self.depends_on = depends_on
self.depends_on_nodes = depends_on self.depends_on_nodes = depends_on

View File

@@ -81,7 +81,7 @@ class TranslateNodeTemplates():
return self._translate_nodetemplates() return self._translate_nodetemplates()
def _recursive_handle_properties(self, resource): def _recursive_handle_properties(self, resource):
'''Recursively handle the properties of the depens_on_nodes nodes.''' '''Recursively handle the properties of the depends_on_nodes nodes.'''
# Use of hashtable (dict) here should be faster? # Use of hashtable (dict) here should be faster?
if resource in self.processed_resources: if resource in self.processed_resources:
return return
@@ -152,14 +152,14 @@ class TranslateNodeTemplates():
# handle built-in properties of HOT resources # handle built-in properties of HOT resources
# if a resource depends on other resources, # if a resource depends on other resources,
# their properties needs to be handled first. # their properties need to be handled first.
# Use recursion to handle the properties of the # Use recursion to handle the properties of the
# dependent nodes in correct order # dependent nodes in correct order
self.processed_resources = [] self.processed_resources = []
for resource in self.hot_resources: for resource in self.hot_resources:
self._recursive_handle_properties(resource) self._recursive_handle_properties(resource)
# handle resources that need to expand to more then one HOT resource # handle resources that need to expand to more than one HOT resource
expansion_resources = [] expansion_resources = []
for resource in self.hot_resources: for resource in self.hot_resources:
expanded = resource.handle_expansion() expanded = resource.handle_expansion()