From c4b59336c28b5040931d535dd7dcaa5653239b65 Mon Sep 17 00:00:00 2001 From: Arjun Kashyap Date: Wed, 3 Jan 2018 21:58:09 +0530 Subject: [PATCH] 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 --- manila/share/share_types.py | 4 ++-- ...705533-manage-api-error-message-fix-967b0d44c09b914a.yaml | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/bug-1705533-manage-api-error-message-fix-967b0d44c09b914a.yaml diff --git a/manila/share/share_types.py b/manila/share/share_types.py index 0aa818cd71..710af6b9af 100644 --- a/manila/share/share_types.py +++ b/manila/share/share_types.py @@ -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): diff --git a/releasenotes/notes/bug-1705533-manage-api-error-message-fix-967b0d44c09b914a.yaml b/releasenotes/notes/bug-1705533-manage-api-error-message-fix-967b0d44c09b914a.yaml new file mode 100644 index 0000000000..af9bf66db4 --- /dev/null +++ b/releasenotes/notes/bug-1705533-manage-api-error-message-fix-967b0d44c09b914a.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Error message changed for manage API. +