246
247
err_type = "Server"
249
class HeatInvalidStateError(HeatAPIException):
251
Cannot perform action on stack in its current state
254
title = 'InvalidAction'
255
explanation = "Cannot perform action on stack in its current state"
258
250
def map_remote_error(ex):
260
252
Map rpc_common.RemoteError exceptions returned by the engine
277
269
'UserParameterMissing',
279
271
denied_errors = ('Forbidden', 'NotAuthorized')
280
already_exists_errors = ('StackExists',)
281
invalid_state_errors = ('ActionInProgress',)
283
if ex.exc_type in inval_param_errors:
284
return HeatInvalidParameterValueError(detail=ex.value)
285
elif ex.exc_type in denied_errors:
286
return HeatAccessDeniedError(detail=ex.value)
287
elif ex.exc_type in already_exists_errors:
288
return AlreadyExistsError(detail=ex.value)
289
elif ex.exc_type in invalid_state_errors:
290
return HeatInvalidStateError(detail=ex.value)
272
already_exists_errors = ('StackExists')
274
ex_type = ex.__class__.__name__
276
if ex_type.endswith(rpc_common._REMOTE_POSTFIX):
277
ex_type = ex_type[:-len(rpc_common._REMOTE_POSTFIX)]
279
if ex_type in inval_param_errors:
280
return HeatInvalidParameterValueError(detail=str(ex.message))
281
elif ex_type in denied_errors:
282
return HeatAccessDeniedError(detail=str(ex.message))
283
elif ex_type in already_exists_errors:
284
return AlreadyExistsError(detail=str(ex.message))
292
286
# Map everything else to internal server error for now
293
return HeatInternalFailureError(detail=ex.value)
287
return HeatInternalFailureError(detail=str(ex.message))