yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #71201
[Bug 1749983] Re: Unhelpful error message when trying to force detach and content-type header is missing
Reviewed: https://review.openstack.org/545378
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=c100c8f1888f8963ed5cf81661e52889d765d2b2
Submitter: Zuul
Branch: master
commit c100c8f1888f8963ed5cf81661e52889d765d2b2
Author: Matt Riedemann <mriedem.os@xxxxxxxxx>
Date: Fri Feb 16 11:31:10 2018 -0500
Provide a hint when performing a volume action can't find the method
There is no CLI for the os-force_detach volume action API, and while
making a request for it with curl, I mistakenly used the Accept
header rather than the Content-Type header and got the unhelpful
error message:
"There is no such action: None"
We can provide some simple details in the error message about
making sure the request body is correct and that the Content-Type
header is specified to help the user.
Change-Id: I00600c297e39c0dd097f9da80b1dccb38ee3d235
Closes-Bug: #1749983
** Changed in: cinder
Status: In Progress => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1749983
Title:
Unhelpful error message when trying to force detach and content-type
header is missing
Status in Cinder:
Fix Released
Status in OpenStack Compute (nova):
In Progress
Bug description:
I was trying to force detach a volume using curl like so:
curl -d '{"os-force_detach": {}}' -H "accept: application/json" -H "x
-auth-token: $token"
http://199.204.45.19/volume/v3/e9d773beeef2435eb59f7c6eeaf685a9/volumes/126c8d4b-c582
-484a-8c09-fe901a7dc17f/action
And I'd get this error message back:
{"badRequest": {"message": "There is no such action: None", "code":
400}}
When I dug into the cinder-api logs, I saw this:
Feb 16 16:08:49 queens devstack@c-api.service[1549]: DEBUG
cinder.api.openstack.wsgi [None req-c7279a60-f7ba-
4a11-98f2-8fa2b2ec281d demo demo] Unrecognized Content-Type provided
in request {{(pid=1723) get_body
/opt/stack/cinder/cinder/api/openstack/wsgi.py:724}}
Changing the 'accept' header to 'content-type' fixed it:
curl -d '{"os-force_detach": {}}' -H "content-type: application/json"
-H "x-auth-token: $token"
http://199.204.45.19/volume/v3/e9d773beeef2435eb59f7c6eeaf685a9/volumes/126c8d4b-c582
-484a-8c09-fe901a7dc17f/action
I get a policy error since I'm not an admin (default policy rule on
this API is admin-only), but it went through properly:
{"forbidden": {"message": "Policy doesn't allow
volume_extension:volume_admin_actions:force_detach to be performed.",
"code": 403}}
The bug is that the missing content-type results in a very unhelpful
error message.
To manage notifications about this bug go to:
https://bugs.launchpad.net/cinder/+bug/1749983/+subscriptions