Add a NodeData class to roll up resource data

Formalise the format for the output data from a node in the convergence
graph (i.e. resource reference ID, attributes, &c.) by creating an object
with an API rather than ad-hoc dicts.

Change-Id: I7a705b41046bfbf81777e233e56aba24f3166510
Partially-Implements: blueprint stack-definition
This commit is contained in:
Zane Bitter
2017-02-24 10:10:26 -05:00
parent 3a7aee527e
commit bc4fde4dce
31 changed files with 334 additions and 101 deletions

View File

@@ -2008,18 +2008,16 @@ class Stack(collections.Mapping):
def has_cache_data(self, resource_name):
return (self.cache_data is not None and
self.cache_data.get(resource_name) is not None)
resource_name in self.cache_data)
def cache_data_reference_id(self, resource_name):
return self.cache_data.get(
resource_name, {}).get('reference_id')
return self.cache_data[resource_name].reference_id()
def cache_data_resource_attribute(self, resource_name, attribute_key):
return self.cache_data.get(
resource_name, {}).get('attrs', {}).get(attribute_key)
return self.cache_data[resource_name].attribute(attribute_key)
def cache_data_resource_all_attributes(self, resource_name):
return self.cache_data.get(resource_name, {}).get('attrs', {})
return self.cache_data[resource_name].attributes()
def mark_complete(self):
"""Mark the update as complete.