neutronclient with pre-determined auth token fails when doing Client.get_auth_info()

Bug #1277120 reported by Ihar Hrachyshka
18
This bug affects 4 people
Affects Status Importance Assigned to Milestone
python-neutronclient
Fix Released
Medium
Ihar Hrachyshka

Bug Description

When token is provided on __init__, no authentication is actually done (fine) and client.httpclient.auth_[tenant|user]_id keys are not set (bad). This results in call to client.get_auth_info() to fail with KeyError (this was revealed when working with neutron-metadata-agent):

2014-02-06 13:04:11.733 9043 ERROR neutron.agent.metadata.agent [req-e3ccb644-b95a-410f-9e46-ff3a8a6cb476 None] Unexpected error.
2014-02-06 13:04:11.733 9043 TRACE neutron.agent.metadata.agent Traceback (most recent call last):
2014-02-06 13:04:11.733 9043 TRACE neutron.agent.metadata.agent File "/opt/stack/new/neutron/neutron/agent/metadata/agent.py", line 101, in __call__
2014-02-06 13:04:11.733 9043 TRACE neutron.agent.metadata.agent instance_id, tenant_id = self._get_instance_and_tenant_id(req)
2014-02-06 13:04:11.733 9043 TRACE neutron.agent.metadata.agent File "/opt/stack/new/neutron/neutron/agent/metadata/agent.py", line 133, in _get_instance_and_tenant_id
2014-02-06 13:04:11.733 9043 TRACE neutron.agent.metadata.agent self.auth_info = qclient.get_auth_info()
2014-02-06 13:04:11.733 9043 TRACE neutron.agent.metadata.agent File "/opt/stack/new/python-neutronclient/neutronclient/v2_0/client.py", line 1168, in get_auth_info
2014-02-06 13:04:11.733 9043 TRACE neutron.agent.metadata.agent return self.httpclient.get_auth_info()
2014-02-06 13:04:11.733 9043 TRACE neutron.agent.metadata.agent File "/opt/stack/new/python-neutronclient/neutronclient/client.py", line 272, in get_auth_info
2014-02-06 13:04:11.733 9043 TRACE neutron.agent.metadata.agent 'auth_tenant_id': self.auth_tenant_id,
2014-02-06 13:04:11.733 9043 TRACE neutron.agent.metadata.agent AttributeError: 'HTTPClient' object has no attribute 'auth_tenant_id'
2014-02-06 13:04:11.733 9043 TRACE neutron.agent.metadata.agent

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

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

Changed in python-neutronclient:
assignee: nobody → Ihar Hrachyshka (ihar-hrachyshka)
status: New → In Progress
Changed in python-neutronclient:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-neutronclient (master)

Reviewed: https://review.openstack.org/71551
Committed: https://git.openstack.org/cgit/openstack/python-neutronclient/commit/?id=02baef46968b816ac544b037297273ff6a4e8e1b
Submitter: Jenkins
Branch: master

commit 02baef46968b816ac544b037297273ff6a4e8e1b
Author: Ihar Hrachyshka <email address hidden>
Date: Thu Feb 6 15:54:14 2014 +0100

    Fixed get_auth_info() for pre-authenticated clients

    When a client is instantiated with pre-defined authorization token,
    no authentication is done, so no auth_[tenant|user]_id keys are set
    for HTTPClient. As a result, Client.get_auth_info() fails with KeyError.

    Fixed the issue by setting those keys on HTTPClient initialization.

    Change-Id: Ifc9d6b128286b635346a7bc026fcc55dbd002050
    Closes-Bug: 1277120

Changed in python-neutronclient:
status: In Progress → Fix Committed
Akihiro Motoki (amotoki)
Changed in python-neutronclient:
milestone: none → 2.3.0-2.3.4
Akihiro Motoki (amotoki)
Changed in python-neutronclient:
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.