Error message should not include SQL command

There is SQL command included in the http response for conflicting
resource provider. We should remove SQL related errors from the
error message.

Change-Id: I47726919f9a2d2a767564909f454c334e42ffbe0
Closes-bug: 1664117
This commit is contained in:
liyingjun 2017-02-22 11:20:12 +08:00
parent da67f5d5ec
commit e5fc58dc5c
2 changed files with 6 additions and 6 deletions

View File

@ -185,8 +185,8 @@ def create_resource_provider(req):
resource_provider.create()
except db_exc.DBDuplicateEntry as exc:
raise webob.exc.HTTPConflict(
_('Conflicting resource provider already exists: %(error)s') %
{'error': exc})
_('Conflicting resource provider %(name)s already exists.') %
{'name': data['name']})
except exception.ObjectActionError as exc:
raise webob.exc.HTTPBadRequest(
_('Unable to create resource provider %(rp_uuid)s: %(error)s') %
@ -331,8 +331,8 @@ def update_resource_provider(req):
resource_provider.save()
except db_exc.DBDuplicateEntry as exc:
raise webob.exc.HTTPConflict(
_('Conflicting resource provider already exists: %(error)s') %
{'error': exc})
_('Conflicting resource provider %(name)s already exists.') %
{'name': data['name']})
except exception.ObjectActionError as exc:
raise webob.exc.HTTPBadRequest(
_('Unable to save resource provider %(rp_uuid)s: %(error)s') %

View File

@ -54,7 +54,7 @@ tests:
uuid: $ENVIRON['RP_UUID']
status: 409
response_strings:
- Conflicting resource provider already exists
- Conflicting resource provider $ENVIRON['RP_NAME'] already exists
response_json_paths:
$.errors[0].title: Conflict
@ -67,7 +67,7 @@ tests:
uuid: ada30fb5-566d-4fe1-b43b-28a9e988790c
status: 409
response_strings:
- Conflicting resource provider already exists
- Conflicting resource provider $ENVIRON['RP_NAME'] already exists
response_json_paths:
$.errors[0].title: Conflict