Merge "Refactor DB resource fetching from Resource to Stack"

This commit is contained in:
Jenkins 2014-05-06 23:10:57 +00:00 committed by Gerrit Code Review
commit f19af6724e
2 changed files with 7 additions and 5 deletions

View File

@ -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:

View File

@ -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