standalone auth is broken

Bug #1416170 reported by Angus Salkeld
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
High
Jamie Lennox

Bug Description

heat -d stack-list
DEBUG (http) curl -g -i -X GET -H 'X-Auth-User: <email address hidden>' -H 'User-Agent: python-heatclient' -H 'X-Auth-Key: 9cGrqpZf' -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'X-Auth-Url: http://158.85.165.2:5000/v2.0' http://10.0.0.75:8004/v1/7da46bff2e694677af4d055fc4d68164/stacks?
INFO (connectionpool) Starting new HTTP connection (1): 10.0.0.75
DEBUG (connectionpool) "GET /v1/7da46bff2e694677af4d055fc4d68164/stacks HTTP/1.1" 400 3015
DEBUG (http)
HTTP/1.1 400 Bad Request
date: Fri, 30 Jan 2015 00:02:30 GMT
connection: keep-alive
content-type: application/json; charset=UTF-8
content-length: 3015
x-openstack-request-id: req-dd4bcb43-0b81-461f-ab2e-ca79b554e01b

{"explanation": "The server could not comply with the request since it is either malformed or otherwise incorrect.", "code": 400, "error": {"message": "'KeystoneClientV2' object has no attribute 'session'", "traceback": "Traceback (most recent call last):\n File \"/home/angus/work/heat/heat/api/middleware/fault.py\", line 150, in process_request\n return req.get_response(self.application)\n File \"/usr/local/lib/python2.7/dist-packages/webob/request.py\", line 1320, in send\n application, catch_exc_info=False)\n File \"/usr/local/lib/python2.7/dist-packages/webob/request.py\", line 1284, in call_application\n app_iter = application(self.environ, start_response)\n File \"/usr/local/lib/python2.7/dist-packages/webob/dec.py\", line 130, in __call__\n resp = self.call_func(req, *args, **self.kwargs)\n File \"/usr/local/lib/python2.7/dist-packages/webob/dec.py\", line 195, in call_func\n return self.func(req, *args, **kwargs)\n File \"/home/angus/work/heat/heat/common/wsgi.py\", line 398, in __call__\n response = req.get_response(self.application)\n File \"/usr/local/lib/python2.7/dist-packages/webob/request.py\", line 1320, in send\n application, catch_exc_info=False)\n File \"/usr/local/lib/python2.7/dist-packages/webob/request.py\", line 1284, in call_application\n app_iter = application(self.environ, start_response)\n File \"/usr/local/lib/python2.7/dist-packages/webob/dec.py\", line 130, in __call__\n resp = self.call_func(req, *args, **self.kwargs)\n File \"/usr/local/lib/python2.7/dist-packages/webob/dec.py\", line 195, in call_func\n return self.func(req, *args, **kwargs)\n File \"/home/angus/work/heat/heat/common/wsgi.py\", line 398, in __call__\n response = req.get_response(self.application)\n File \"/usr/local/lib/python2.7/dist-packages/webob/request.py\", line 1320, in send\n application, catch_exc_info=False)\n File \"/usr/local/lib/python2.7/dist-packages/webob/request.py\", line 1284, in call_application\n app_iter = application(self.environ, start_response)\n File \"/usr/local/lib/python2.7/dist-packages/webob/dec.py\", line 130, in __call__\n resp = self.call_func(req, *args, **self.kwargs)\n File \"/usr/local/lib/python2.7/dist-packages/webob/dec.py\", line 195, in call_func\n return self.func(req, *args, **kwargs)\n File \"/home/angus/work/heat/heat/common/wsgi.py\", line 398, in __call__\n response = req.get_response(self.application)\n File \"/usr/local/lib/python2.7/dist-packages/webob/request.py\", line 1320, in send\n application, catch_exc_info=False)\n File \"/usr/local/lib/python2.7/dist-packages/webob/request.py\", line 1284, in call_application\n app_iter = application(self.environ, start_response)\n File \"/home/angus/work/heat/heat/common/auth_password.py\", line 55, in __call__\n session = heat_keystoneclient.KeystoneClient(ctx).session\nAttributeError: 'KeystoneClientV2' object has no attribute 'session'\n", "type": "AttributeError"}, "title": "Bad Request"}

Traceback (most recent call last):
  File "/usr/local/bin/heat", line 9, in <module>
    load_entry_point('python-heatclient==0.2.12.post64', 'console_scripts', 'heat')()
  File "/home/angus/work/python-heatclient/heatclient/shell.py", line 706, in main
    HeatShell().main(args)
  File "/home/angus/work/python-heatclient/heatclient/shell.py", line 656, in main
    args.func(client, args)
  File "/home/angus/work/python-heatclient/heatclient/v1/shell.py", line 581, in do_stack_list
    utils.print_list(stacks, fields, sortby_index=3)
  File "/home/angus/work/python-heatclient/heatclient/openstack/common/cliutils.py", line 169, in print_list
    for o in objs:
  File "/home/angus/work/python-heatclient/heatclient/v1/stacks.py", line 100, in paginate
    stacks = self._list(url, 'stacks')
  File "/home/angus/work/python-heatclient/heatclient/openstack/common/apiclient/base.py", line 117, in _list
    body = self.client.get(url).json()
  File "/home/angus/work/python-heatclient/heatclient/common/http.py", line 292, in get
    return self.client_request("GET", url, **kwargs)
  File "/home/angus/work/python-heatclient/heatclient/common/http.py", line 285, in client_request
    resp, body = self.json_request(method, url, **kwargs)
  File "/home/angus/work/python-heatclient/heatclient/common/http.py", line 266, in json_request
    resp = self._http_request(url, method, **kwargs)
  File "/home/angus/work/python-heatclient/heatclient/common/http.py", line 221, in _http_request
    raise exc.from_response(resp)
heatclient.exc.HTTPBadRequest: ERROR: 'KeystoneClientV2' object has no attribute 'session'

Angus Salkeld (asalkeld)
Changed in heat:
importance: Undecided → High
Changed in heat:
assignee: nobody → Jamie Lennox (jamielennox)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

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

Changed in heat:
status: New → In Progress
Steven Hardy (shardy)
Changed in heat:
milestone: none → kilo-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/151542
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=beb393e56cf9303944dd87ea683f8abeb934d39a
Submitter: Jenkins
Branch: master

commit beb393e56cf9303944dd87ea683f8abeb934d39a
Author: Jamie Lennox <email address hidden>
Date: Fri Jan 30 16:53:33 2015 +1100

    Fix the standalone authentication mechanism

    The keystoneclient used by the password_auth may be a v2 or v3 client.
    This means that we shouldn't access arbitrary attributes from the client
    as they many not exist on both.

    We really don't care about the version of keystoneclient in this case
    all we want to do is create a session for getting a token, so copy the
    session creation logic out to auth_password.

    Change-Id: I1b1f3e3f5822c0bba2dc2e8f592760dd5dba7fbc
    Closes-Bug: #1416170

Changed in heat:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to heat (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/151966

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to heat (master)

Reviewed: https://review.openstack.org/151966
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=700feb1304a677b7e9a31864369e0751994fd533
Submitter: Jenkins
Branch: master

commit 700feb1304a677b7e9a31864369e0751994fd533
Author: Jamie Lennox <email address hidden>
Date: Mon Feb 2 09:08:42 2015 +1100

    Further fix standalone authentication

    Whilst a previous patch fixed the main problem in using the keystone v2
    client these references were missed. The v2 client has not been updated
    to use the session so it has no session attribute that can be relied
    upon.

    In this patch I've left a FIXME to make this session object more global.
    My hope is that when all these smaller issues have been eradicated we
    can come back and make a more consistent authentication workflow for all
    these clients.

    Change-Id: I50012daf8b8669f1910003f73296a6c16b6b4cf3
    Related-Bug: #1416170

Thierry Carrez (ttx)
Changed in heat:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in heat:
milestone: kilo-2 → 2015.1.0
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.