ironicclient expects endpoint to be defined by default

Bug #1498608 reported by Julia Kreger on 2015-09-22
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-ironicclient
Fix Released
Medium
Julia Kreger

Bug Description

For programatic use of the python-ironicclient api, when keystone sessions are being used, an endpoint may not be defined by the invocation as it is included in the keystone session data.

Example using os_ironic ansible modules with current shade master branch code:

Traceback (most recent call last):
  File "/home/jkreger/.ansible/tmp/ansible-tmp-1442940371.78-69826534691607/os_ironic", line 2066, in <module>
    main()
  File "/home/jkreger/.ansible/tmp/ansible-tmp-1442940371.78-69826534691607/os_ironic", line 243, in main
    server = cloud.get_machine(node_id)
  File "/usr/local/lib/python2.7/dist-packages/shade/__init__.py", line 3365, in get_machine
    _tasks.MachineNodeGet(node_id=name_or_id))
  File "/usr/local/lib/python2.7/dist-packages/shade/task_manager.py", line 103, in submitTask
    return task.wait()
  File "/usr/local/lib/python2.7/dist-packages/shade/task_manager.py", line 70, in wait
    self._traceback)
  File "/usr/local/lib/python2.7/dist-packages/shade/task_manager.py", line 75, in run
    self.done(self.main(client))
  File "/usr/local/lib/python2.7/dist-packages/shade/_tasks.py", line 461, in main
    return client.ironic_client.node.get(**self.args)
  File "/usr/local/lib/python2.7/dist-packages/shade/__init__.py", line 3312, in ironic_client
    os_ironic_api_version=self.ironic_api_microversion)
  File "/usr/local/lib/python2.7/dist-packages/shade/__init__.py", line 325, in _get_client
    client = client_class(**constructor_args)
  File "/usr/local/lib/python2.7/dist-packages/ironicclient/client.py", line 116, in Client
    return client_class(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ironicclient/v1/client.py", line 51, in __init__
    self.http_client = http._construct_http_client(*args, **kwargs)
TypeError: _construct_http_client() takes at least 1 argument (3 given)

This is because endpoint is an explicitly required argument to the _construct_http_client method by having no default value. Setting the default to None in the method results in the session data being used as-expected.

Changed in ironic:
assignee: nobody → Julia Kreger (juliaashleykreger)
status: New → In Progress

I have proposed https://review.openstack.org/#/c/226475/ to remedy this issue.

Dmitry Tantsur (divius) on 2015-10-05
affects: ironic → python-ironicclient
Changed in python-ironicclient:
status: In Progress → Fix Committed
importance: Undecided → Medium
Changed in python-ironicclient:
milestone: none → 0.10.0
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers