diff --git a/heat/engine/parser.py b/heat/engine/parser.py index b0cdfb011..e076f7549 100644 --- a/heat/engine/parser.py +++ b/heat/engine/parser.py @@ -121,6 +121,12 @@ class Stack(collections.Mapping): template_resources.items()) return self._resources + def db_resource_get(self, name): + if not self.id: + return None + return db_api.resource_get_by_name_and_stack(self.context, + name, self.id) + @property def dependencies(self): if self._dependencies is None: diff --git a/heat/engine/resource.py b/heat/engine/resource.py index d2298a549..00fe10241 100644 --- a/heat/engine/resource.py +++ b/heat/engine/resource.py @@ -125,11 +125,7 @@ class Resource(object): self.abandon_in_progress = False - if stack.id: - resource = db_api.resource_get_by_name_and_stack(self.context, - name, stack.id) - else: - resource = None + resource = stack.db_resource_get(name) if resource: self.resource_id = resource.nova_instance