gnocchi resource list response "Malformed X-User-Id (HTTP 400)"

Bug #1666818 reported by zhaozhilong on 2017-02-22
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Gnocchi
Fix Released
Undecided
zhaozhilong

Bug Description

1). gnocchi --debug resource list :
REQ: curl -g -i -X GET http://lb.midea.net:8041/v1/resource/generic? -H "User-Agent: keystoneauth1" -H "Accept: application/json, */*" -H "X-Auth-Token: {SHA1}37f2bdd8f341b3488bedcf14ab3314b76715591e"
Starting new HTTP connection (1): lb.midea.net
"GET /v1/resource/generic HTTP/1.1" 400 75
RESP: [400] date: Wed, 22 Feb 2017 08:27:12 GMT content-length: 75 content-type: application/json; charset=UTF-8 server: Werkzeug/0.9.1 Python/2.7.5
RESP BODY: {"code": 400, "description": "Malformed X-User-Id", "title": "Bad Request"}

Malformed X-User-Id (HTTP 400)
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/cliff/app.py", line 374, in run_subcommand
    result = cmd.run(parsed_args)
  File "/usr/lib/python2.7/site-packages/cliff/display.py", line 92, in run
    column_names, data = self.take_action(parsed_args)
  File "/usr/lib/python2.7/site-packages/gnocchiclient/v1/resource_cli.py", line 51, in take_action
    **self._get_pagination_options(parsed_args))
  File "/usr/lib/python2.7/site-packages/gnocchiclient/v1/resource.py", line 62, in list
    return self._get(url).json()
  File "/usr/lib/python2.7/site-packages/gnocchiclient/v1/base.py", line 37, in _get
    return self.client.api.get(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/keystoneauth1/adapter.py", line 168, in get
    return self.request(url, 'GET', **kwargs)
  File "/usr/lib/python2.7/site-packages/gnocchiclient/client.py", line 38, in request
    raise exceptions.from_response(resp, url, method)
BadRequest: Malformed X-User-Id (HTTP 400)
Traceback (most recent call last):
  File "/usr/bin/gnocchi", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/site-packages/gnocchiclient/shell.py", line 209, in main
    return GnocchiShell().run(args)
  File "/usr/lib/python2.7/site-packages/cliff/app.py", line 255, in run
    result = self.run_subcommand(remainder)
  File "/usr/lib/python2.7/site-packages/cliff/app.py", line 374, in run_subcommand
    result = cmd.run(parsed_args)
  File "/usr/lib/python2.7/site-packages/cliff/display.py", line 92, in run
    column_names, data = self.take_action(parsed_args)
  File "/usr/lib/python2.7/site-packages/gnocchiclient/v1/resource_cli.py", line 51, in take_action
    **self._get_pagination_options(parsed_args))
  File "/usr/lib/python2.7/site-packages/gnocchiclient/v1/resource.py", line 62, in list
    return self._get(url).json()
  File "/usr/lib/python2.7/site-packages/gnocchiclient/v1/base.py", line 37, in _get
    return self.client.api.get(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/keystoneauth1/adapter.py", line 168, in get
    return self.request(url, 'GET', **kwargs)
  File "/usr/lib/python2.7/site-packages/gnocchiclient/client.py", line 38, in request
    raise exceptions.from_response(resp, url, method)
gnocchiclient.exceptions.BadRequest: Malformed X-User-Id (HTTP 400)

I do not know how to solve this problem?
Is this a bug?

zhaozhilong (zhaozhilong) wrote :

Find a solution.
My keystone use ldap, the user's UUID is not 32-bit.
So gnocchi recognized the illegal parameters.

----------------------------------------------------
    user_id = headers.get("X-User-Id")
    if user_id:
        try:
            user_id = six.text_type(uuid.UUID(user_id))
        except Exception:
            abort(400, "Malformed X-User-Id")

---------------------------------------------------

Changed in python-gnocchiclient:
assignee: nobody → zhaozhilong (zhaozhilong)
Julien Danjou (jdanjou) wrote :

This seems to be an old version of Gnocchi. Please upgrade.

Changed in python-gnocchiclient:
status: New → Fix Released
affects: python-gnocchiclient → gnocchi
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers