From d4cb97b1ac121f6fddab76befba11cc3b92c5b0e Mon Sep 17 00:00:00 2001 From: Simeon Monov Date: Tue, 14 Apr 2015 10:08:52 -0700 Subject: [PATCH] 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 --- translator/hot/syntax/hot_resource.py | 11 +++++++++++ translator/hot/translate_node_templates.py | 6 +++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/translator/hot/syntax/hot_resource.py b/translator/hot/syntax/hot_resource.py index e08e400..39542b1 100644 --- a/translator/hot/syntax/hot_resource.py +++ b/translator/hot/syntax/hot_resource.py @@ -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 diff --git a/translator/hot/translate_node_templates.py b/translator/hot/translate_node_templates.py index 8adbf61..bcb10b6 100644 --- a/translator/hot/translate_node_templates.py +++ b/translator/hot/translate_node_templates.py @@ -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()