Can't use TokenManager. authenticate() with publicurl

Bug #1567025 reported by Joe D'Andrea
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-keystoneclient
Won't Fix
High
Unassigned

Bug Description

See attached example.py for sample code and context.

Create a v2 client object:

* Use publicurl as the auth_url endpoint
* Use credentials that confer an admin role

Call client.tokens.authenticate() using any valid token/tenant_id.

The call fails when adminurl is unreachable.

Expectation is that publicurl would be used as the auth_url endpoint, however ...

From https://github.com/openstack/python-keystoneclient/blob/5a7f800e271695f21809d6251e91f6ac8e13ce23/keystoneclient/v2_0/tokens.py#L62-L69

 # NOTE(jamielennox): try doing a regular admin query first. If there is
 # no endpoint that can satisfy the request (eg an unscoped token) then
 # issue it against the auth_url.
 try:
     token_ref = self._post(*args, **kwargs)
 except exceptions.EndpointNotFound:
     kwargs['endpoint_filter'] = {'interface': auth.AUTH_INTERFACE}

Our keystone adminurl is intentionally on a private network and *unreachable* from where example.py is running (in a VM).

After quite a while, an exception is raised (keystoneauth1.exceptions.ConnectFailure) and auth_url is never tried.

Meanwhile, a direct API call, skipping python-keystoneclient, works fine:

* POST to publicurl, /v2/tokens, from the same location/VM
* Use X-Auth-Token of someone with an admin role
* Pass in the same valid token/tenant_id as before.

Additionally, a CLI call such as "nova list" (using the same credentials and conferred admin role) also works.

Revision history for this message
Joe D'Andrea (jdandrea) wrote :
description: updated
Revision history for this message
Joe D'Andrea (jdandrea) wrote :

Workaround: pass interface='public' to the Client constructor:

    client = client.Client(session=sess, interface='public')

Note that in the v2 and v3 documentation, interface isn't documented as a parameter:

http://docs.openstack.org/developer/python-keystoneclient/api/keystoneclient.v2_0.html#module-keystoneclient.v2_0.client
http://docs.openstack.org/developer/python-keystoneclient/api/keystoneclient.v3.html#keystoneclient.v3.client.Client

Joe D'Andrea (jdandrea)
Changed in keystone:
assignee: nobody → Joe D'Andrea (joedandrea)
description: updated
Revision history for this message
Dolph Mathews (dolph) wrote :

Is there a patch up for this? It was filed under the "wrong" project, so the bots would not have been able to link a patch.

affects: keystone → python-keystoneclient
Revision history for this message
Dolph Mathews (dolph) wrote :

(This also sounds like the fix could belong in keystoneauth)

Changed in python-keystoneclient:
importance: Undecided → High
status: New → Triaged
Revision history for this message
Lance Bragstad (lbragstad) wrote :

Automatically unassigning due to inactivity.

Changed in python-keystoneclient:
assignee: Joe D'Andrea (joedandrea) → nobody
Changed in python-keystoneclient:
assignee: nobody → Aleksey Nakoryakov (alfnak)
Revision history for this message
Lance Bragstad (lbragstad) wrote :

Automatically unassigning due to inactivity.

Changed in python-keystoneclient:
assignee: Aleksey Nakoryakov (alfnak) → nobody
Revision history for this message
Morgan Fainberg (mdrnstm) wrote :

With v2.0 gone, marking this as invalid. Keystoneauth should be used not keystoneclient

Changed in python-keystoneclient:
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

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