discovery constructor fails with only session parameter

Bug #1513839 reported by Monty Taylor
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-keystoneclient
Fix Released
High
Monty Taylor

Bug Description

keystoneclient.client.Client requires an auth_url or endpoint parameter even when a session is provided. This is of course silly. The versioned constructors do the right thing.

devstack ~ $ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from keystoneauth1.identity.generic import password
>>> from keystoneclient import session
>>> from keystoneclient.v3 import client
>>> auth = password.Password(auth_url='http://localhost:5000/v3', username='admin', password='secrete', project_name='admin', user_domain_id='default', project_domain_id='default')
>>> sess = session.Session(auth=auth)
>>> ks = client.Client(session=sess)
>>> ks.users.list()
[<User domain_id=default, enabled=True, id=44d3844e5f144a3b9b02f75789294c49, links={u'self': u'http://104.130.20.86:35357/v3/users/44d3844e5f144a3b9b02f75789294c49'}, name=glance>, <User domain_id=default, enabled=True, id=46908d556fa04a9882af17a4e33cac91, links={u'self': u'http://104.130.20.86:35357/v3/users/46908d556fa04a9882af17a4e33cac91'}, name=cinder>, <User domain_id=default, <email address hidden>, enabled=True, id=810bc1127f82492a9ee1c93de3d4cb4b, links={u'self': u'http://104.130.20.86:35357/v3/users/810bc1127f82492a9ee1c93de3d4cb4b'}, name=alt_demo>, <User domain_id=default, <email address hidden>, enabled=True, id=a6e6d2c77ded4a3286f7884b1f3d7561, links={u'self': u'http://104.130.20.86:35357/v3/users/a6e6d2c77ded4a3286f7884b1f3d7561'}, name=demo>, <User domain_id=default, enabled=True, id=eb81211f42614af8bb3218085d27b81a, links={u'self': u'http://104.130.20.86:35357/v3/users/eb81211f42614af8bb3218085d27b81a'}, name=nova>, <User domain_id=default, enabled=True, id=f96ffeaec20848f1846dd419ed995803, links={u'self': u'http://104.130.20.86:35357/v3/users/f96ffeaec20848f1846dd419ed995803'}, name=admin>]
>>> quit()
devstack ~ $ pip freeze | grep keystone
-e git://git.openstack.org/openstack/keystone.git@a37675d2bbf0de89c45324db50964aa8f54a49b6#egg=keystone-dev
keystoneauth1==1.1.0
keystonemiddleware==2.3.0
python-keystoneclient==1.8.1

devstack ~ $ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from keystoneauth1.identity.generic import password
>>> from keystoneclient import session
>>> from keystoneclient import client
>>> auth = password.Password(auth_url='http://localhost:5000/v3', username='admin', password='secrete', project_name='admin', user_domain_id='default', project_domain_id='default')
>>> sess = session.Session(auth=auth)
>>> ks = client.Client(session=sess)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/keystoneclient/client.py", line 62, in Client
    d = discover.Discover(session=session, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/keystoneclient/utils.py", line 337, in inner
    return func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/keystoneclient/discover.py", line 176, in __init__
    _('Not enough information to determine URL. Provide either '
keystoneclient.exceptions.DiscoveryFailure: Not enough information to determine URL. Provide either auth_url or endpoint

Dolph Mathews (dolph)
Changed in python-keystoneclient:
importance: Undecided → High
status: New → Confirmed
Revision history for this message
Dolph Mathews (dolph) wrote :

To reproduce in tests:

diff --git a/keystoneclient/tests/unit/auth/test_identity_v3.py b/keystoneclient/tests/unit/auth/test_identity_v3.py
index aaae500..f0c36af 100644
--- a/keystoneclient/tests/unit/auth/test_identity_v3.py
+++ b/keystoneclient/tests/unit/auth/test_identity_v3.py
@@ -216,7 +216,7 @@ class V3IdentityPlugin(utils.TestCase):
                         username=self.TEST_USER,
                         password=self.TEST_PASS)
         s = session.Session(auth=a)
- cs = client.Client(session=s, auth_url=self.TEST_URL)
+ cs = client.Client(session=s)

         # As a sanity check on the auth_ref, make sure client has the
         # proper user id, that it fetches the right project response

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/242495

Changed in python-keystoneclient:
assignee: nobody → Monty Taylor (mordred)
status: Confirmed → In Progress
Changed in python-keystoneclient:
assignee: Monty Taylor (mordred) → Dolph Mathews (dolph)
Changed in python-keystoneclient:
assignee: Dolph Mathews (dolph) → Monty Taylor (mordred)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-keystoneclient (master)

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

commit d9031c252848d89270a543b67109a46f9c505c86
Author: Monty Taylor <email address hidden>
Date: Fri Nov 6 09:09:08 2015 -0500

    Pull the endpoint from the Session

    If the user passes a Session in, we can pull the endpoint to use for
    discovery from the Session itself, rather than erroring.

    Closes-Bug: #1513839
    Co-Authored-By: Dolph Mathews <email address hidden>
    Change-Id: I82a41c67f80d2494f04739d82b112b7ff1dc4682

Changed in python-keystoneclient:
status: In Progress → Fix Committed
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/python-keystoneclient 2.0.0

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

Changed in python-keystoneclient:
status: Fix Committed → Fix Released
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.