Show correct version of data in convergence resource list

In convergence, there can be multiple versions of the same resource
present in a stack at one time. The fix for bug 1301320 was supposed to
make data for all versions available from the resource list API. And
while it does go through all of the resources in the database and create
Resource objects for each one, they were each created with the correct
version of the resource definition but DB data from the latest resource.
(Only the name is passed to the Resource object, it has to figure out
which database row to load data from itself - and it will choose the
same one every time.)

With this change, we always load the correct DB data into the
newly-created Resource object.

Change-Id: I6b9d1b86b3dbf767bccebddd78275bbf0933029a
Closes-Bug: #1704194
This commit is contained in:
Zane Bitter 2017-07-13 14:34:10 -04:00
parent 5ce238fb17
commit 9a6acc70b0
1 changed files with 3 additions and 1 deletions

View File

@ -392,7 +392,9 @@ class Stack(collections.Mapping):
if defn is None:
return None
return resource.Resource(db_res.name, defn, self)
res = resource.Resource(db_res.name, defn, self)
res._load_data(db_res)
return res
def resource_get(self, name):
"""Return a stack resource, even if not in the current template."""