Example on fresh devstack:
$ openstack --os-cloud devstack event trait description security_group_rule.create.end
http://192.168.122.233:8977 "GET /v2/event_types/security_group_rule.create.end/traits/ HTTP/1.1" 401 455
RESP: [401] Date: Wed, 14 Mar 2018 15:54:35 GMT Server: Apache/2.4.18 (Ubuntu) x-openstack-request-id: req-0086f261-0f76-4810-be1b-9d4727efdf00 WWW-Authenticate: Keystone uri='http://192.168.122.233/identity' Content-Length: 455 Connection: close Content-Type: application/json
RESP BODY: {"error_message": "<html>\n <head>\n <title>401 Unauthorized</title>\n </head>\n <body>\n <h1>401 Unauthorized</h1>\n This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.<br /><br />\nNot Authorized to access project aa4dcc3bc5ae4729bda30840e984edc6\n\n\n </body>\n</html>"}
'unicode' object has no attribute 'get'
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/cliff/app.py", line 400, in run_subcommand
result = cmd.run(parsed_args)
File "/usr/local/lib/python2.7/dist-packages/osc_lib/command/command.py", line 41, in run
return super(Command, self).run(parsed_args)
File "/usr/local/lib/python2.7/dist-packages/cliff/display.py", line 116, in run
column_names, data = self.take_action(parsed_args)
File "/opt/stack/python-pankoclient/pankoclient/v2/events_cli.py", line 151, in take_action
event_traits = ac.event_trait_description.list(parsed_args.type_name)
File "/opt/stack/python-pankoclient/pankoclient/v2/events.py", line 89, in list
return self._list(url)
File "/opt/stack/python-pankoclient/pankoclient/common/base.py", line 57, in _list
resp, body = self.api.get(url, headers=headers)
File "/usr/local/lib/python2.7/dist-packages/keystoneauth1/adapter.py", line 304, in get
return self.request(url, 'GET', **kwargs)
File "/opt/stack/python-pankoclient/pankoclient/client.py", line 39, in request
raise exceptions.from_response(resp, url, method)
File "/opt/stack/python-pankoclient/pankoclient/exceptions.py", line 175, in from_response
desc = body.get('error_message', {}).get('faultstring')
AttributeError: 'unicode' object has no attribute 'get'
clean_up EventTraitDescription: 'unicode' object has no attribute 'get'
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/osc_lib/shell.py", line 134, in run
ret_val = super(OpenStackShell, self).run(argv)
File "/usr/local/lib/python2.7/dist-packages/cliff/app.py", line 279, in run
result = self.run_subcommand(remainder)
File "/usr/local/lib/python2.7/dist-packages/osc_lib/shell.py", line 169, in run_subcommand
ret_value = super(OpenStackShell, self).run_subcommand(argv)
File "/usr/local/lib/python2.7/dist-packages/cliff/app.py", line 400, in run_subcommand
result = cmd.run(parsed_args)
File "/usr/local/lib/python2.7/dist-packages/osc_lib/command/command.py", line 41, in run
return super(Command, self).run(parsed_args)
File "/usr/local/lib/python2.7/dist-packages/cliff/display.py", line 116, in run
column_names, data = self.take_action(parsed_args)
File "/opt/stack/python-pankoclient/pankoclient/v2/events_cli.py", line 151, in take_action
event_traits = ac.event_trait_description.list(parsed_args.type_name)
File "/opt/stack/python-pankoclient/pankoclient/v2/events.py", line 89, in list
return self._list(url)
File "/opt/stack/python-pankoclient/pankoclient/common/base.py", line 57, in _list
resp, body = self.api.get(url, headers=headers)
File "/usr/local/lib/python2.7/dist-packages/keystoneauth1/adapter.py", line 304, in get
return self.request(url, 'GET', **kwargs)
File "/opt/stack/python-pankoclient/pankoclient/client.py", line 39, in request
raise exceptions.from_response(resp, url, method)
File "/opt/stack/python-pankoclient/pankoclient/exceptions.py", line 175, in from_response
desc = body.get('error_message', {}).get('faultstring')
AttributeError: 'unicode' object has no attribute 'get'
END return value: 1
The reason seems to be the 401 response from Apache has the 'error_message' as a string, not as a dict with 'faultstring' key.
Reviewed: https:/ /review. openstack. org/552981 /git.openstack. org/cgit/ openstack/ python- pankoclient/ commit/ ?id=8fc3a19e1e9 98c34ffe9be921a 5ba3f3b622addd
Committed: https:/
Submitter: Zuul
Branch: master
commit 8fc3a19e1e998c3 4ffe9be921a5ba3 f3b622addd
Author: vmarkov <email address hidden>
Date: Wed Mar 14 19:01:46 2018 +0200
Handle strings as response error_message
Change-Id: I9643303973edd9 92066ff013a9cec 21be689ae84
Closes-Bug: #1755851