← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1415935] Re: encode_headers which has NoneType value would raise exception

 

What version of glanceclient are you using?

** Project changed: glance => python-glanceclient

** Changed in: python-glanceclient
       Status: New => Incomplete

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1415935

Title:
  encode_headers which has NoneType value would raise exception

Status in Python client library for Glance:
  Incomplete

Bug description:
  refer to https://review.openstack.org/#/c/129289/

   if you're using Nova but don't have Nova configured with
  auth_strategy='keystone' (see nova.image.glance._create_glance_client for details),
  and when you resize(or other operation need call glance) an VM, it may call
  glanceclient, and code may go to the logic like:
  /usr/lib/python2.7/site-packages/glanceclient/v1/client.py(36)__init__()
  -> self.http_client = http.HTTPClient(endpoint, *args, **kwargs)
  > /usr/lib/python2.7/site-packages/glanceclient/common/http.py(57)__init__()

  and in /usr/lib/python2.7/site-packages/glanceclient/common/http.py(57)__init__()
   self.identity_headers = kwargs.get('identity_headers')  <<<<<<<<<<
   self.auth_token = kwargs.get('token')
  and  the self.identity_headers may be like:
  {'X-Service-Catalog': '[]', 'X-Auth-Token': None, 'X-Roles': u'admin', 'X-Tenant-Id': None, 'X-User-Id': None, 'X-Identity-Status': 'Confirmed'}

  and for https://review.openstack.org/#/c/136326/,
  for the code:
          if self.identity_headers:
              for k, v in six.iteritems(self.identity_headers):
                  headers.setdefault(k, v)

  headers would be like: {'X-Service-Catalog': '[]', 'X-Auth-Token':
  None, 'X-Roles': u'admin', 'X-Tenant-Id': None, 'X-User-Id': None, 'X
  -Identity-Status': 'Confirmed', ....}

  so "headers = self.encode_headers(headers)"  in /usr/lib/python2.7/site-packages/glanceclient/common/http.py(1957)__request()
  would raise TypeError("NoneType can't be encoded"), thus resize(or other operation need call glance) would fail.

To manage notifications about this bug go to:
https://bugs.launchpad.net/python-glanceclient/+bug/1415935/+subscriptions


References