From: Angus Salkeld Date: Fri, 13 Apr 2012 00:13:42 +0000 (+1000) Subject: Fix 'heat list' when there are no stacks X-Git-Tag: 2014.1~2039 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=5bb18073cbf069b5812c64b1f5c7d4e93ef49ddf;p=openstack-build%2Fheat-build.git Fix 'heat list' when there are no stacks Signed-off-by: Angus Salkeld --- diff --git a/heat/api/v1/stacks.py b/heat/api/v1/stacks.py index 00bd0b19..ea5eb4a5 100644 --- a/heat/api/v1/stacks.py +++ b/heat/api/v1/stacks.py @@ -55,8 +55,9 @@ class StackController(object): res = {'ListStacksResponse': {'ListStacksResult': {'StackSummaries': [] } } } summaries = res['ListStacksResponse']['ListStacksResult']['StackSummaries'] - for s in stack_list['stacks']: - summaries.append(s) + if stack_list != None: + for s in stack_list['stacks']: + summaries.append(s) return res diff --git a/heat/engine/manager.py b/heat/engine/manager.py index 7172fc11..3d591c3b 100644 --- a/heat/engine/manager.py +++ b/heat/engine/manager.py @@ -40,6 +40,8 @@ class EngineManager(manager.Manager): logger.info('context is %s' % context) res = {'stacks': [] } stacks = db_api.stack_get_all(None) + if stacks == None: + return res for s in stacks: ps = parser.Stack(s.name, s.raw_template.template, params) mem = {}