Fix error message in the manage API

When the manage API is called on a particular share without specifying
the share type and the also the default share type is not found, the API
raises an error message which contains the share_type_id of default
sharetype which is not existant. The error message which should be
displayed is "Default share type not found.". The fix for this bug is
to change the parameters sent to the ShareTypeNotFound class, changing
it from ShareTypeNotFound(reason=msg) to ShareTypeNotFound(message=msg).

**Previously:
manila manage \
stack-VirtualBox@prague#lvm-single-pool \
NFS \
127.0.0.1:/opt/stack/data/manila/mnt/share-2cd5d0de-994b-4cbf-bf55-9808e
49266f0
ERROR: Share type %(share_type_id)s could not be found.

**Now:
manila manage \
stack-VirtualBox@prague#lvm-single-pool \
NFS \
127.0.0.1:/opt/stack/data/manila/mnt/share-2cd5d0de-994b-4cbf-bf55-9808e
49266f0
ERROR: Default share type not found.

Closes-Bug: #1705533
Change-Id: I36a76a93b7d0f54c1e9aec43e332cb94b0b389f3
This commit is contained in:
Arjun Kashyap 2018-01-03 21:58:09 +05:30
parent 171a773093
commit c4b59336c2
2 changed files with 7 additions and 2 deletions

View File

@ -146,8 +146,8 @@ def get_share_type_by_name_or_id(context, share_type=None):
if not share_type:
share_type_ref = get_default_share_type(context)
if not share_type_ref:
msg = _("Default share type not found")
raise exception.ShareTypeNotFound(reason=msg)
msg = _("Default share type not found.")
raise exception.ShareTypeNotFound(message=msg)
return share_type_ref
if uuidutils.is_uuid_like(share_type):

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Error message changed for manage API.