From: Steven Hardy Date: Thu, 2 Aug 2012 12:15:53 +0000 (+0100) Subject: heat engine : raise appropriate error for incorrect stack_name X-Git-Tag: 2014.1~1551 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=1ed94e1382166ccf50f116645b4d20dcd2c74e7f;p=openstack-build%2Fheat-build.git heat engine : raise appropriate error for incorrect stack_name Raise an AttributeError instead of returning a string when passed an incorrect stack name, this then maps to the appropriate error in the API. Fixes #182 Change-Id: I7fe80496883bfbe515d9c235de812aaa14c41c12 Signed-off-by: Steven Hardy --- diff --git a/heat/engine/manager.py b/heat/engine/manager.py index e86ee632..2e1c26ce 100644 --- a/heat/engine/manager.py +++ b/heat/engine/manager.py @@ -102,7 +102,7 @@ class EngineManager(manager.Manager): auth.authenticate(context) if db_api.stack_get_by_name(None, stack_name): - return {'Error': 'Stack already exists with that name.'} + raise AttributeError('Stack already exists with that name') tmpl = parser.Template(template) @@ -141,7 +141,7 @@ class EngineManager(manager.Manager): # Get the database representation of the existing stack db_stack = db_api.stack_get_by_name(None, stack_name) if not db_stack: - return {'Error': 'No stack exists with that name.'} + raise AttributeError('No stack exists with that name') current_stack = parser.Stack.load(context, db_stack.id)