[Bug 1559072] Re: [SRU] exceptions.from_response with webob 1.6.0 results in "AttributeError: 'unicode' object has no attribute 'get'"

OpenStack Infra 1559072 at bugs.launchpad.net
Wed Oct 5 00:34:29 UTC 2016


Reviewed:  https://review.openstack.org/307021
Committed: https://git.openstack.org/cgit/openstack/python-novaclient/commit/?id=70c35e6e3d2aed9f37d5101dafd22c5905ec8583
Submitter: Jenkins
Branch:    stable/mitaka

commit 70c35e6e3d2aed9f37d5101dafd22c5905ec8583
Author: Matt Riedemann <mriedem at us.ibm.com>
Date:   Fri Mar 18 19:17:47 2016 -0400

    Handle error response for webob>=1.6.0
    
    WebOb change https://github.com/Pylons/webob/pull/230 changed
    the way in which the error response body is formatted such that
    it's no longer a nested dict. So we have to handle both the
    old convention of an error message key to the response body error
    dict and the new way with just the error body dict.
    
    This was reported upstream:
    
    https://github.com/Pylons/webob/issues/235
    
    But given this was apparently implemented as a long-overdue change
    in WebOb the behavior is not likely to change.
    
    Change-Id: If653a247d842786d2824b4b3a5c0cde1383ed7ab
    Closes-Bug: #1559072


** Tags added: in-stable-mitaka

** Bug watch added: github.com/Pylons/webob/issues #235
   https://github.com/Pylons/webob/issues/235

-- 
You received this bug notification because you are a member of Ubuntu
OpenStack, which is subscribed to python-novaclient in Ubuntu.
https://bugs.launchpad.net/bugs/1559072

Title:
  [SRU] exceptions.from_response with webob 1.6.0 results in
  "AttributeError: 'unicode' object has no attribute 'get'"

Status in networking-midonet:
  Fix Released
Status in python-cinderclient:
  New
Status in python-novaclient:
  Fix Released
Status in python-openstackclient:
  Invalid
Status in python-novaclient package in Ubuntu:
  Fix Released
Status in python-novaclient source package in Xenial:
  Fix Committed
Status in python-novaclient source package in Yakkety:
  Fix Released

Bug description:
  [Impact] [Testcase]
  Running on Ubuntu 14.04.
  After installing nova from source in either the Liberty release or Mitaka, with WebOb 1.6.0, running any nova command generated this error:
  root at openstack-ubu-controller:~# nova service-list
  ERROR (AttributeError): 'unicode' object has no attribute 'get'

  The equivalent openstack commands work correctly. After downgrading
  WebOb to 1.5.1 AND restarting the nova-api service everything works.

  Detailed output from nova -debug service-list with the error:

  root at openstack-ubu-controller:~# nova --debug service-list
  DEBUG (extension:157) found extension EntryPoint.parse('v2token = keystoneauth1.loading._plugins.identity.v2:Token')
  DEBUG (extension:157) found extension EntryPoint.parse('admin_token = keystoneauth1.loading._plugins.admin_token:AdminToken')
  DEBUG (extension:157) found extension EntryPoint.parse('v3oidcauthcode = keystoneauth1.loading._plugins.identity.v3:OpenIDConnectAuthorizationCode')
  DEBUG (extension:157) found extension EntryPoint.parse('v2password = keystoneauth1.loading._plugins.identity.v2:Password')
  DEBUG (extension:157) found extension EntryPoint.parse('v3password = keystoneauth1.loading._plugins.identity.v3:Password')
  DEBUG (extension:157) found extension EntryPoint.parse('v3oidcpassword = keystoneauth1.loading._plugins.identity.v3:OpenIDConnectPassword')
  DEBUG (extension:157) found extension EntryPoint.parse('token = keystoneauth1.loading._plugins.identity.generic:Token')
  DEBUG (extension:157) found extension EntryPoint.parse('v3token = keystoneauth1.loading._plugins.identity.v3:Token')
  DEBUG (extension:157) found extension EntryPoint.parse('password = keystoneauth1.loading._plugins.identity.generic:Password')
  DEBUG (session:248) REQ: curl -g -i -X GET http://10.0.1.3:5000/v2.0 -H "Accept: application/json" -H "User-Agent: keystoneauth1/2.3.0 python-requests/2.9.1 CPython/2.7.6"
  INFO (connectionpool:207) Starting new HTTP connection (1): 10.0.1.3
  DEBUG (connectionpool:387) "GET /v2.0 HTTP/1.1" 200 334
  DEBUG (session:277) RESP: [200] Content-Length: 334 Vary: X-Auth-Token Keep-Alive: timeout=5, max=100 Server: Apache/2.4.7 (Ubuntu) Connection: Keep-Alive Date: Fri, 18 Mar 2016 12:41:58 GMT Content-Type: application/json x-openstack-request-id: req-a0c68cd5-ea29-4391-942f-130cc69d15f8
  RESP BODY: {"version": {"status": "stable", "updated": "2014-04-17T00:00:00Z", "media-types": [{"base": "application/json", "type": "application/vnd.openstack.identity-v2.0+json"}], "id": "v2.0", "links": [{"href": "http://10.0.1.3:5000/v2.0/", "rel": "self"}, {"href": "http://docs.openstack.org/", "type": "text/html", "rel": "describedby"}]}}

  DEBUG (v2:63) Making authentication request to http://10.0.1.3:5000/v2.0/tokens
  DEBUG (connectionpool:387) "POST /v2.0/tokens HTTP/1.1" 200 2465
  DEBUG (session:248) REQ: curl -g -i -X GET http://10.0.1.3:8774/v1.1/b77d640e127e488fb42a7c0716ba53a5 -H "User-Agent: python-novaclient" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}381893576ad46c62b587f4963d769b89441b919a"
  INFO (connectionpool:207) Starting new HTTP connection (1): 10.0.1.3
  DEBUG (connectionpool:387) "GET /v1.1/b77d640e127e488fb42a7c0716ba53a5 HTTP/1.1" 404 112
  DEBUG (session:277) RESP: [404] Date: Fri, 18 Mar 2016 12:41:59 GMT Connection: keep-alive Content-Type: application/json; charset=UTF-8 Content-Length: 112 X-Compute-Request-Id: req-f10a2016-9a88-48fd-af1d-5f800fc9e11a
  RESP BODY: {"message": "The resource could not be found.<br /><br />\n\n\n", "code": "404 Not Found", "title": "Not Found"}

  DEBUG (shell:894) 'unicode' object has no attribute 'get'
  Traceback (most recent call last):
    File "/usr/local/lib/python2.7/dist-packages/novaclient/shell.py", line 892, in main
      OpenStackComputeShell().main(argv)
    File "/usr/local/lib/python2.7/dist-packages/novaclient/shell.py", line 726, in main
      api_version = api_versions.discover_version(self.cs, api_version)
    File "/usr/local/lib/python2.7/dist-packages/novaclient/api_versions.py", line 267, in discover_version
      client)
    File "/usr/local/lib/python2.7/dist-packages/novaclient/api_versions.py", line 248, in _get_server_version_range
      version = client.versions.get_current()
    File "/usr/local/lib/python2.7/dist-packages/novaclient/v2/versions.py", line 83, in get_current
      return self._get_current()
    File "/usr/local/lib/python2.7/dist-packages/novaclient/v2/versions.py", line 57, in _get_current
      return self._get(url, "version")
    File "/usr/local/lib/python2.7/dist-packages/novaclient/base.py", line 297, in _get
      _resp, body = self.api.client.get(url)
    File "/usr/local/lib/python2.7/dist-packages/keystoneauth1/adapter.py", line 173, in get
      return self.request(url, 'GET', **kwargs)
    File "/usr/local/lib/python2.7/dist-packages/novaclient/client.py", line 92, in request
      raise exceptions.from_response(resp, body, url, method)
    File "/usr/local/lib/python2.7/dist-packages/novaclient/exceptions.py", line 274, in from_response
      message = error.get('message')
  AttributeError: 'unicode' object has no attribute 'get'
  ERROR (AttributeError): 'unicode' object has no attribute 'get'

  Since nova-api must be restarted for this to either take effect or go
  away (with the WebOb downgrade) this appears to be an issue with the
  nova-api process. The failing message from the api service is 112
  bytes long while the successful one (using downgraded WebOb) is 52
  bytes long.

  [Regression Potential]
  The regression potential is minimal. The patch is cherry-picked without change from stable/newton to stable/mitaka, and I've already tested it in a ppa.

To manage notifications about this bug go to:
https://bugs.launchpad.net/networking-midonet/+bug/1559072/+subscriptions



More information about the Ubuntu-openstack-bugs mailing list