Bug 1396572 - Calling ironicclient API fails with stack trace
Summary: Calling ironicclient API fails with stack trace
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: python-ironicclient
Version: 10.0 (Newton)
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: ---
Assignee: RHOS Maint
QA Contact: Raviv Bar-Tal
URL:
Whiteboard:
Depends On:
Blocks: 1335596 1356451
TreeView+ depends on / blocked
 
Reported: 2016-11-18 16:15 UTC by Chris Dearborn
Modified: 2016-12-09 15:36 UTC (History)
15 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-23 15:51:22 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Chris Dearborn 2016-11-18 16:15:35 UTC
Description of problem:
We have network validation code that calls into ironicclient, node.get_by_instance_uuid().  This has worked in the past, but is now failing with the following stack trace:

Traceback (most recent call last):
  File "./validate_networks.py", line 314, in <module>
    network_validation.build_node_list()
  File "./validate_networks.py", line 155, in build_node_list
    nova_server.id)
  File "/usr/lib/python2.7/site-packages/ironicclient/v1/node.py", line 202, in get_by_instance_uuid
    nodes = self._list(self._path(path), 'nodes')
  File "/usr/lib/python2.7/site-packages/ironicclient/common/base.py", line 154, in _list
    resp, body = self.api.json_request('GET', url)
  File "/usr/lib/python2.7/site-packages/ironicclient/common/http.py", line 560, in json_request
    resp = self._http_request(url, method, **kwargs)
  File "/usr/lib/python2.7/site-packages/ironicclient/common/http.py", line 190, in wrapper
    return func(self, url, method, **kwargs)
  File "/usr/lib/python2.7/site-packages/ironicclient/common/http.py", line 532, in _http_request
    resp = self.session.request(url, method,
AttributeError: 'str' object has no attribute 'request'

Printing self.session immediately before the session.request call yields:
### self.session: ba6f13201dec7d0ad6d86c73ddad34d71139bcd8


Version-Release number of selected component (if applicable):
python-ironicclient-1.7.0-1.el7ost.noarch

How reproducible:
Call ironic_client.node.get_by_instance_uuid(<uuid)

Steps to Reproduce:
1. See above.

Actual results:
Call blows up with stack trace because expected session object and got a string.

Expected results:
Call should succeed.

Additional info:

Comment 1 Chris Dearborn 2016-11-18 18:15:34 UTC
I tried changing the code to use ironic_client.node.list(), and it blows up with the same error, so it looks like the ironic client api is just plain broken.  Stack trace is below.

[stack@director network-validation]$ ./validate_networks.py
WARNING:ironicclient.common.http:The following arguments are ignored when using the session to construct a client: auth_ref, token
Traceback (most recent call last):
  File "./validate_networks.py", line 322, in <module>
    network_validation.build_node_list()
  File "./validate_networks.py", line 151, in build_node_list
    for ironic_server in ironic.node.list():
  File "/usr/lib/python2.7/site-packages/ironicclient/v1/node.py", line 132, in list
    return self._list(self._path(path), "nodes")
  File "/usr/lib/python2.7/site-packages/ironicclient/common/base.py", line 154, in _list
    resp, body = self.api.json_request('GET', url)
  File "/usr/lib/python2.7/site-packages/ironicclient/common/http.py", line 553, in json_request
    resp = self._http_request(url, method, **kwargs)
  File "/usr/lib/python2.7/site-packages/ironicclient/common/http.py", line 190, in wrapper
    return func(self, url, method, **kwargs)
  File "/usr/lib/python2.7/site-packages/ironicclient/common/http.py", line 525, in _http_request
    resp = self.session.request(url, method,
AttributeError: 'str' object has no attribute 'request'


Note You need to log in before you can comment on or make changes to this bug.