using session construct client will miss service_catalog property

Bug #1508374 reported by ZhiQiang Fan
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
python-keystoneclient
Fix Released
Medium
Mikhail Nikolaenko

Bug Description

from keystoneclient.v2_0 import client
from keystoneclient import session
from keystoneclient.auth.identity import v2 as v2_auth

c1 = client.Client(auth_url='http://127.0.0.1:5000/v2.0',username='admin',password='admin',tenant_name='admin',)
print c1.service_catalog

auth = v2_auth.Password(auth_url='http://127.0.0.1:5000/v2.0',username='admin',password='admin',tenant_name='admin',)
s = session.Session(auth=auth, verify=False)
c2 = client.Client(session=s)

#print c2.users.list() # succeed

print c2.tenant_name # print None!

print c2.service_catalog # raise attr exception,
                         # even though httpclient has defined this property
"""
the output is:

<keystoneclient.service_catalog.ServiceCatalogV2 object at 0x7f77cb6e92d0>
None
Traceback (most recent call last):
  File "/tmp/test.py", line 16, in <module>
    print c.service_catalog
  File "/usr/local/lib/python2.7/dist-packages/keystoneclient/httpclient.py", line 898, in __getattr__
    raise AttributeError(_("Unknown Attribute: %s") % name)
AttributeError: Unknown Attribute: service_catalog

the service_catalog property has gone, I have no idea why and how this happen
"""

Tags: office-hours
Changed in python-keystoneclient:
assignee: nobody → Jude Augustine Job (judeaugustine-j)
Changed in python-keystoneclient:
status: New → In Progress
description: updated
description: updated
Revision history for this message
Steve Martinelli (stevemar) wrote :

removing assignee due to inactivity

Changed in python-keystoneclient:
assignee: Jude Augustine Job (judeaugustine-j) → nobody
importance: Undecided → Medium
Boris Bobrov (bbobrov)
Changed in python-keystoneclient:
status: In Progress → Confirmed
description: updated
Revision history for this message
Jude Augustine Job (judeaugustine-j) wrote :
Download full text (4.8 KiB)

Hi steve,

these are my observation,

>>> c1 = client.Client(auth_url='http://127.0.0.1:5000/v2.0',username='admin',password='admin',tenant_name='admin',)
>>> c1.service_catalog
<keystoneclient.service_catalog.ServiceCatalogV2 object at 0x7f6b7778c110>

>>> c1.auth_ref
{u'token': {u'issued_at': u'2016-01-04T06:53:57.039630', u'expires': u'2016-01-04T07:53:56Z', u'id': u'3d1b72db67de47478b82eb984e050a79', u'tenant': {u'enabled': True, u'description': u'', u'name': u'admin', u'id': u'c270ca15e7fd42a6bb0ddb1cd3daa1cd'}, u'audit_ids': [u'Z2oX1NiPTuGpblNcxYh_Jg']}, 'version': 'v2.0', u'serviceCatalog': [{u'endpoints_links': [], u'endpoints': [{u'adminURL': u'http://10.0.2.15:8774/v2.1/c270ca15e7fd42a6bb0ddb1cd3daa1cd', u'region': u'RegionOne', u'publicURL': u'http://10.0.2.15:8774/v2.1/c270ca15e7fd42a6bb0ddb1cd3daa1cd', u'internalURL': u'http://10.0.2.15:8774/v2.1/c270ca15e7fd42a6bb0ddb1cd3daa1cd', u'id': u'30fd588732804ab7b9433d032c9a7fb4'}], u'type': u'compute', u'name': u'nova'}, {u'endpoints_links': [], u'endpoints': [{u'adminURL': u'http://10.0.2.15:9696/', u'region': u'RegionOne', u'publicURL': u'http://10.0.2.15:9696/', u'internalURL': u'http://10.0.2.15:9696/', u'id': u'37ac12e8e0a046b694954e810b46d152'}], u'type': u'network', u'name': u'neutron'}, {u'endpoints_links': [], u'endpoints': [{u'adminURL': u'http://10.0.2.15:8776/v2/c270ca15e7fd42a6bb0ddb1cd3daa1cd', u'region': u'RegionOne', u'publicURL': u'http://10.0.2.15:8776/v2/c270ca15e7fd42a6bb0ddb1cd3daa1cd', u'internalURL': u'http://10.0.2.15:8776/v2/c270ca15e7fd42a6bb0ddb1cd3daa1cd', u'id': u'402dd5e3318b41f6b5585a3aac6120a7'}], u'type': u'volumev2', u'name': u'cinderv2'}, {u'endpoints_links': [], u'endpoints': [{u'adminURL': u'http://10.0.2.15:9292', u'region': u'RegionOne', u'publicURL': u'http://10.0.2.15:9292', u'internalURL': u'http://10.0.2.15:9292', u'id': u'74de76f8b0ee40dca65afab8edad6c53'}], u'type': u'image', u'name': u'glance'}, {u'endpoints_links': [], u'endpoints': [{u'adminURL': u'http://10.0.2.15:8774/v2/c270ca15e7fd42a6bb0ddb1cd3daa1cd', u'region': u'RegionOne', u'publicURL': u'http://10.0.2.15:8774/v2/c270ca15e7fd42a6bb0ddb1cd3daa1cd', u'internalURL': u'http://10.0.2.15:8774/v2/c270ca15e7fd42a6bb0ddb1cd3daa1cd', u'id': u'664493f9b32c4d83bf9ec75db66624a4'}], u'type': u'compute_legacy', u'name': u'nova_legacy'}, {u'endpoints_links': [], u'endpoints': [{u'adminURL': u'http://10.0.2.15:8776/v1/c270ca15e7fd42a6bb0ddb1cd3daa1cd', u'region': u'RegionOne', u'publicURL': u'http://10.0.2.15:8776/v1/c270ca15e7fd42a6bb0ddb1cd3daa1cd', u'internalURL': u'http://10.0.2.15:8776/v1/c270ca15e7fd42a6bb0ddb1cd3daa1cd', u'id': u'5d721d7abf2943f78838769d970444d6'}], u'type': u'volume', u'name': u'cinder'}, {u'endpoints_links': [], u'endpoints': [{u'adminURL': u'http://10.0.2.15:8773/', u'region': u'RegionOne', u'publicURL': u'http://10.0.2.15:8773/', u'internalURL': u'http://10.0.2.15:8773/', u'id': u'15cbdbabe70e4a4fb876d603333388da'}], u'type': u'ec2', u'name': u'ec2'}, {u'endpoints_links': [], u'endpoints': [{u'adminURL': u'http://10.0.2.15:35357/v2.0', u'region': u'RegionOne', u'publicURL': u'http://10.0.2.15:5000/v2.0', u'internalURL': u'http://10.0.2.15:5000/v2.0', u'id': u'37c102f2...

Read more...

Changed in python-keystoneclient:
assignee: nobody → Jude Augustine Job (judeaugustine-j)
Changed in python-keystoneclient:
assignee: Jude Augustine Job (judeaugustine-j) → nobody
Sirisha (sirisha-1)
Changed in python-keystoneclient:
assignee: nobody → Sirisha (sirisha-1)
Sirisha (sirisha-1)
Changed in python-keystoneclient:
assignee: Sirisha (sirisha-1) → nobody
Revision history for this message
Sam Morrison (sorrison) wrote :

Just a note I get this with version 2.3.1.

There doesn't seem to be anyway to get the service catalog if you're using session auth. Should this bug be higher priority?

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-keystoneclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/339150

Changed in python-keystoneclient:
assignee: nobody → Mikhail Nikolaenko (mnikolaenko)
status: Confirmed → In Progress
Revision history for this message
Yong Hu Sun (yonghusun) wrote :

I'm also seeing this issue with keystone client version 2.3.1. Is there a workaround for this issue if session auth is used? Thanks.

Revision history for this message
Tung Doan (tungdoan) wrote :

Does it have any progress in this bug?

Revision history for this message
Tung Doan (tungdoan) wrote :

Hi all, please kindly let me know if we have some ways to get service catalog using session? In fact, I would like to know how I can get token id using session. Thanks

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-keystoneclient (master)

Reviewed: https://review.openstack.org/339150
Committed: https://git.openstack.org/cgit/openstack/python-keystoneclient/commit/?id=b405d71a5f9562414ce6b08f7eb4556f534dd273
Submitter: Jenkins
Branch: master

commit b405d71a5f9562414ce6b08f7eb4556f534dd273
Author: Mikhail Nikolaenko <email address hidden>
Date: Thu Jul 7 19:30:59 2016 +0300

    Fix missing service_catalog parameter in Client object

    Return None if service_catalog parameter does not exist.

    service_catalog is the property and it is not initialized on object creation.
    service_catalog tries to get value from auth_ref and raises AttributeError
    exception if auth_ref is not initialized. It worked before we introduced
    sessions, because authentication happened on client instantiation. Now,
    when sessions are used, auth_ref is not initialized until the first
    request. This change adds try-catch block in service_catalog property
    to catch this error.

    Change-Id: I58eb888f0989241f9e5626564bd48d901b324d36
    Closes-Bug: #1508374

Changed in python-keystoneclient:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-keystoneclient 3.8.0

This issue was fixed in the openstack/python-keystoneclient 3.8.0 release.

Revision history for this message
Yan E Li (liyane) wrote :

The problem persists in higher version of python-keystonclient. I tried on version python-keystoneclient (3.13.0) and python-keystoneclient (3.10.0)

Could someone kindly check this problem?

tags: added: office-hours
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.