Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

python glance client attribute error

Part of our service will be grabbing builds and uploading them into glance. I've written a test for the glance image list using

From the code (pardon the line numbers):

232     def testme(self):
233         print self.auth_url
234         print self.tenant_name
235         print "testage!"
236         loader = loading.get_plugin_loader('password')
237         auth = loader.load_from_options(
238             auth_url=self.auth_url,
239             username=self.username,
240             password=self.password,
241             project_name=self.tenant_name)
242         sess = session.Session(auth=auth)
243         keystone = ksclient.Client(session=sess)
244         glance = Client('2', endpoint=self.glance_url, session=keystone)
246         for image in glance.images.list():
247             print image

The image list fails:

Traceback (most recent call last):
  File "", line 11, in <module>
  File "/usr/local/bin/tools/", line 246, in testme
    for image in glance.images.list():
  File "/usr/lib/python2.7/dist-packages/glanceclient/v2/", line 176, in list
    for image in paginate(url, page_size, limit):
  File "/usr/lib/python2.7/dist-packages/glanceclient/v2/", line 108, in paginate
    resp, body = self.http_client.get(next_url)
  File "/usr/lib/python2.7/dist-packages/keystoneclient/", line 176, in get
    return self.request(url, 'GET', **kwargs)
  File "/usr/lib/python2.7/dist-packages/glanceclient/common/", line 332, in request
    return self._handle_response(resp)
  File "/usr/lib/python2.7/dist-packages/glanceclient/common/", line 81, in _handle_response
    if not resp.ok:
AttributeError: 'tuple' object has no attribute 'ok'

I've found no other mention of this issue via Google or Bing - is this a glance client bug or my bad coding?