From c100c8f1888f8963ed5cf81661e52889d765d2b2 Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Fri, 16 Feb 2018 11:31:10 -0500 Subject: [PATCH] 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 --- cinder/api/openstack/wsgi.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cinder/api/openstack/wsgi.py b/cinder/api/openstack/wsgi.py index 958a9f1e34e..4e7b436544c 100644 --- a/cinder/api/openstack/wsgi.py +++ b/cinder/api/openstack/wsgi.py @@ -853,7 +853,8 @@ class Resource(wsgi.Application): except (AttributeError, TypeError): return Fault(webob.exc.HTTPNotFound()) except KeyError as ex: - msg = _("There is no such action: %s") % ex.args[0] + msg = (_("There is no such action: %s. Verify the request body " + "and Content-Type header and try again.") % ex.args[0]) return Fault(webob.exc.HTTPBadRequest(explanation=msg)) except exception.MalformedRequestBody: msg = _("Malformed request body")