"UnboundLocalError: local variable 'token'" if incorrectly configured

Bug #1290601 reported by Adam Gandelman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-ironicclient
Fix Released
Medium
Adam Gandelman

Bug Description

An uncaught exception if neither 'os_auth_url' or 'os_auth_token' are present in ironicclient configuration (ie, as used by nova-compute):

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/eventlet/hubs/poll.py", line 97, in wait
    readers.get(fileno, noop).cb(fileno)
  File "/usr/lib/python2.7/dist-packages/eventlet/greenthread.py", line 194, in main
    result = function(*args, **kwargs)
  File "/opt/stack/nova/nova/openstack/common/service.py", line 480, in run_service
    service.start()
  File "/opt/stack/nova/nova/service.py", line 180, in start
    self.manager.init_host()
  File "/opt/stack/nova/nova/compute/manager.py", line 825, in init_host
    self._destroy_evacuated_instances(context)
  File "/opt/stack/nova/nova/compute/manager.py", line 536, in _destroy_evacuated_instances
    local_instances = self._get_instances_on_driver(context, filters)
  File "/opt/stack/nova/nova/compute/manager.py", line 515, in _get_instances_on_driver
    driver_instances = self.driver.list_instances()
  File "/opt/stack/ironic/ironic/nova/virt/ironic/driver.py", line 306, in list_instances
    icli = self._get_client()
  File "/opt/stack/ironic/ironic/nova/virt/ironic/driver.py", line 178, in _get_client
    return ironic_client.get_client(CONF.ironic.api_version, **kwargs)
  File "/opt/stack/python-ironicclient/ironicclient/client.py", line 86, in get_client
    'token': token,
UnboundLocalError: local variable 'token' referenced before assignment

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

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

Changed in python-ironicclient:
assignee: nobody → Adam Gandelman (gandelman-a)
status: New → In Progress
aeva black (tenbrae)
Changed in python-ironicclient:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-ironicclient (master)

Reviewed: https://review.openstack.org/79494
Committed: https://git.openstack.org/cgit/openstack/python-ironicclient/commit/?id=34078241793a5c9df59e4b99084beb71188e0ac8
Submitter: Jenkins
Branch: master

commit 34078241793a5c9df59e4b99084beb71188e0ac8
Author: Adam Gandelman <email address hidden>
Date: Mon Mar 10 16:47:59 2014 -0700

    Avoid traceback with insufficient auth credentials

    Raise an exception if configured credentials are not sufficient
    for obtaining an endpoint and token.

    Change-Id: Ie11a25eb67da2d2c2c8ef40ab984eb2ecb77fdf9
    Closes-Bug: 1290601

Changed in python-ironicclient:
status: In Progress → Fix Committed
Changed in python-ironicclient:
milestone: none → 0.7.0
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.