Fixes few nits in the network features code

- add more detailed comment about the difference between depends_on
  and depends_on_nodes in translator/hot/syntax/hot_resource.py
- fix few typos in translator/hot/translate_node_templates.py

Change-Id: I4cf5d70b972213ba1baae64ef5ed2b8af49e1d17
This commit is contained in:
Simeon Monov
2015-04-14 10:08:52 -07:00
parent 0370edf17a
commit d4cb97b1ac
2 changed files with 14 additions and 3 deletions

View File

@@ -41,6 +41,17 @@ class HotResource(object):
if type == 'OS::Heat::SoftwareConfig':
self.properties['group'] = 'script'
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:
self.depends_on = depends_on
self.depends_on_nodes = depends_on

View File

@@ -81,7 +81,7 @@ class TranslateNodeTemplates():
return self._translate_nodetemplates()
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?
if resource in self.processed_resources:
return
@@ -152,14 +152,14 @@ class TranslateNodeTemplates():
# handle built-in properties of HOT 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
# dependent nodes in correct order
self.processed_resources = []
for resource in self.hot_resources:
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 = []
for resource in self.hot_resources:
expanded = resource.handle_expansion()