From 5bb18073cbf069b5812c64b1f5c7d4e93ef49ddf Mon Sep 17 00:00:00 2001 From: Angus Salkeld Date: Fri, 13 Apr 2012 10:13:42 +1000 Subject: [PATCH] Fix 'heat list' when there are no stacks Signed-off-by: Angus Salkeld --- heat/api/v1/stacks.py | 5 +++-- heat/engine/manager.py | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) 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 = {} -- 2.45.2