Usage example in the README does not work

Bug #1571833 reported by Sean M. Collins
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-keystoneclient
Fix Released
Low
Tin Lam

Bug Description

Tin Lam (lamt)
Changed in python-keystoneclient:
assignee: nobody → Tin Lam (tl3438)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-keystoneclient (master)

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

Changed in python-keystoneclient:
status: New → In Progress
Changed in python-keystoneclient:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-keystoneclient (master)

Reviewed: https://review.openstack.org/308103
Committed: https://git.openstack.org/cgit/openstack/python-keystoneclient/commit/?id=841389810f0fe5363d06c1b46531de951c0228f3
Submitter: Jenkins
Branch: master

commit 841389810f0fe5363d06c1b46531de951c0228f3
Author: Tin Lam <email address hidden>
Date: Tue Apr 19 20:22:03 2016 -0500

    Updated example in README

    Update the usage example in the README to a working one shown in [1].

    [1] http://paste.openstack.org/show/494514/

    Change-Id: Iab2693d82cc2bfeda7cb7634fc5bdeae34cdbb46
    Closes-Bug: #1571833

Changed in python-keystoneclient:
status: In Progress → Fix Released
Revision history for this message
Sean M. Collins (scollins) wrote :

OK, fixing the README is one way to "fix" this bug. But why was the old way broken?

Revision history for this message
Tin Lam (lamt) wrote :

This is kind of weird, I was seeing the error you posted on my home devstack environment last night, but this morning, per your question, I ran the script against a test environment at work, and it seems to be fine. I'll double check my home environment later.

$ pip freeze | grep keystone
keystoneauth1==2.6.0
python-keystoneclient==2.3.1

$ cat test.py
from keystoneclient.v2_0 import client

username = ''
password = ''
tenant_name = ''
auth_url = 'https://snipped:5000/v2.0'

keystone = client.Client(username=username,
                         password=password,
                         tenant_name=tenant_name,
                         auth_url=auth_url)

for t in keystone.tenants.list():
    print t

$ python test.py
<Tenant {u'enabled': True, u'description': ....
<Tenant {u'enabled': True, u'description': ....

Revision history for this message
Tin Lam (lamt) wrote :

Not sure why there is discrepancy between my home devstack and test at work. I find that if I use /v3 in the auth_url, it works fine. However, when I use /v2.0

from keystoneclient.v2_0 import client
import logging

logging.basicConfig(level=logging.DEBUG)

USERNAME='admin'
PASSWORD='password'
TENANT='admin'
AUTH_URL='http://localhost:5000/v2.0'

keystone = client.Client(username=USERNAME, password=PASSWORD, tenant_name=TENANT, auth_url=AUTH_URL)

for t in keystone.tenants.list():
    print t

I see this line:

DEBUG:keystoneclient.auth.identity.v2:Making authentication request to http://localhost:5000/v2.0/tokens
INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): localhost
DEBUG:requests.packages.urllib3.connectionpool:"POST /v2.0/tokens HTTP/1.1" 200 2479
DEBUG:keystoneclient.session:REQ: curl -g -i -X GET http://10.0.2.15:35357/tenants -H "User-Agent: python-keystoneclient" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}f40082d61342c0df4585911fc05ce27d05d7e8a4"
INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): 10.0.2.15
DEBUG:requests.packages.urllib3.connectionpool:"GET /tenants HTTP/1.1" 404 93
DEBUG:keystoneclient.session:RESP: [404] Content-Length: 93 Vary: X-Auth-Token Keep-Alive: timeout=5, max=100 Server: Apache/2.4.7 (Ubuntu) Connection: Keep-Alive Date: Thu, 21 Apr 2016 00:17:27 GMT Content-Type: application/json

It looks like it just drop the /v2.0 in the GET.

Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/python-keystoneclient 3.1.0

This issue was fixed in the openstack/python-keystoneclient 3.1.0 release.

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.