The Stack._find_filtered_resources() method returns Resource objects for
all resources associated with the Stack, regardless of whether they are
current (present in the template; latest version in the case of
convergence). To do this, it previously created a new Resource object
for every resource found in the database.
However, for those resources which *are* current this is unnecessary. We
can access the Resource object simply through self.resources. It turns
out this is necessary for obtaining the required_by list for legacy
stacks, because only the Resources obtained from self.resources also
appear in the Dependencies graph obtained from self.dependencies. The
required_by list is read when listing or showing resources, which would
either return an empty list or fail for legacy stacks.
This patch also makes the Resource.required_by() method more robust in
its error handling.
Change-Id: Id438336e5c88dc7c2d168ba01ee703faa17e8b8e
Closes-Bug: #1703703
Related-Bug: #1523748
(cherry picked from commit 5ce238fb17e38702ceef85a3706e9d2236c43e0e and 65630d4e8bbff2f3ae5c659f8e9396ec7a6f6ae9)
Reviewed: https:/ /review. openstack. org/483571 /git.openstack. org/cgit/ openstack/ heat/commit/ ?id=3fb8722012a 991855fc760ba45 0ed74acd8b43d2
Committed: https:/
Submitter: Jenkins
Branch: stable/ocata
commit 3fb8722012a9918 55fc760ba450ed7 4acd8b43d2
Author: Zane Bitter <email address hidden>
Date: Thu Jul 13 13:59:27 2017 -0400
Don't load new copies of current resources
The Stack._ find_filtered_ resources( ) method returns Resource objects for
all resources associated with the Stack, regardless of whether they are
current (present in the template; latest version in the case of
convergence). To do this, it previously created a new Resource object
for every resource found in the database.
However, for those resources which *are* current this is unnecessary. We
can access the Resource object simply through self.resources. It turns
out this is necessary for obtaining the required_by list for legacy
stacks, because only the Resources obtained from self.resources also
appear in the Dependencies graph obtained from self.dependencies. The
required_by list is read when listing or showing resources, which would
either return an empty list or fail for legacy stacks.
This patch also makes the Resource. required_ by() method more robust in
its error handling.
Change-Id: Id438336e5c88dc 7c2d168ba01ee70 3faa17e8b8e 2ceef85a3706e9d 2236c43e0e
and 65630d4e8bbff2f 3ae5c659f8e9396 ec7a6f6ae9)
Closes-Bug: #1703703
Related-Bug: #1523748
(cherry picked from commit 5ce238fb17e3870