Ask Your Question
0

Curl + Swift + Keystone

asked 2011-11-23 10:29:14 -0500

foexle gravatar image

Heyho guys,

so i'm verry confused about how to use swift + keystone.

My swift config: [pipeline:main] pipeline = healthcheck cache keystone proxy-server

[filter:keystone] use = egg:keystone#swiftauth admin_token = 1111222233334444 keystone_url= http://127.0.0.1:5001/v2.0

Keystone and Swift are running correctly. Now i try to get all informations with curl (Username/PW) to Keystone URL

curl -d '{"auth": {"passwordCredentials": {"username": "testuser", "password": "testing"}}}' -H "Content-type: application/json" http://192.168.0.2:5000/v2.0/tokens

and i get the output: {"access": {"token": {"expires": "2011-11-23T15:36:14", "id": "30abaeac-b8dc-46f9-9aa1-db146c513099", "tenant": {"id": "7", "name": "testing"}}, "serviceCatalog": [{"endpoints": [{"adminURL": "http://192.168.0.2:8774/v1.1/7", "region": "RegionOne", "internalURL": "http://192.168.0.2:8774/v1.1/7", "publicURL": "http://192.168.0.2:8774/v1.1/7"}], "type": "compute", "name": "nova"}, {"endpoints": [{"adminURL": "http://192.168.0.2:9292/v1.0", "region": "RegionOne", "internalURL": "http://192.168.0.2:9292/v1.0/", "publicURL": "http://192.168.0.2:9292/v1.0"}], "type": "image", "name": "glance"}, {"endpoints": [{"adminURL": "http://192.168.0.2:8080/", "region": "RegionOne", "internalURL": "http://192.168.0.2:8080/v1/AUTH_7", "publicURL": "http://78.109.54.196:8080/v1/AUTH_7"}], "type": "object-store", "name": "swift"}, {"endpoints": [{"adminURL": "http://192.168.0.2:5001/v2.0", "region": "RegionOne", "internalURL": "http://192.168.0.2:5001/v2.0", "publicURL": "http://192.168.0.2:5000/v2.0"}], "type": "identity", "name": "keystone"}, {"endpoints": [{"adminURL": "http://192.168.0.2:8774/v1.0", "region": "RegionOne", "internalURL": "http://192.168.0.2:8774/v1.0", "publicURL": "http://192.168.0.2:8774/v1.0"}], "type": "compute", "name": "Nova_compat"}], "user": {"id": "8", "roles": [{"tenantId": "7", "id": "5", "name": "Admin"}], "name": "testuser"}}}

So it looks good.

If i try now

curl -v -H 'X-Auth-Token: 30abaeac-b8dc-46f9-9aa1-db146c513099' http://192.168.0.2:8080/v1

or

curl -v -H 'X-Auth-Token: 30abaeac-b8dc-46f9-9aa1-db146c513099' http://192.168.0.2:8080/v1/AUTH_7

i get every time 401!!

Now i looked in the Keystone log and found this:

http://pastebin.com/T139FdrD

but the token are correct:

******** 2. row ******** id: 30abaeac-b8dc-46f9-9aa1-db146c513099 user_id: 8 tenant_id: 7 expires: 2011-11-23 15:36:14 2 rows in set (0.00 sec)

Do any knows whats wrong? My endpoint_templates should be correct. I've checked this many times.

greetings Heiko

edit retag flag offensive close merge delete

16 answers

Sort by ยป oldest newest most voted
0

answered 2011-11-23 11:52:46 -0500

foexle gravatar image

Nov 23 12:50:58 test1-os swift Keystone middleware called (txn: txd3e1f3f92ad34b1897cf64e17a846978)

Nov 23 12:50:58 test1-os swift token: 30abaeac-b8dc-46f9-9aa1-db146c513099 (txn: txd3e1f3f92ad34b1897cf64e17a846978)

Nov 23 12:50:58 test1-os swift Asking keystone to validate token (txn: txd3e1f3f92ad34b1897cf64e17a846978)

Nov 23 12:50:58 test1-os swift headers: {'Content-type': 'application/json', 'Accept': 'text/json', 'X-Auth-Token': None} (txn: txd3e1f3f92ad34b1897cf64e17a846978)

Nov 23 12:50:58 test1-os swift url: ParseResult(scheme='http', netloc='127.0.0.1:5001', path='/v2.0', params='', query='', fragment='') (txn: txd3e1f3f92ad34b1897cf64e17a846978)

it looks that swift dont have the admin token ? swift headers: {'Content-type': 'application/json', 'Accept': 'text/json', 'X-Auth-Token': None

hmmm but it is set in the config

edit flag offensive delete link more
0

answered 2011-11-23 12:05:49 -0500

which is available here: https://github.com/openstack/keystone...

edit flag offensive delete link more
0

answered 2011-11-23 12:38:55 -0500

I am fixing that error just now, sorry about the confusion, you can remove the timeout=self.auth_timeout() line in 152 and retry?

edit flag offensive delete link more
0

answered 2011-11-23 11:18:30 -0500

Which version of keysone/swift are you using?

edit flag offensive delete link more
0

answered 2011-11-23 11:32:47 -0500

Nice, in which roles your user is in (in keystone).

edit flag offensive delete link more
0

answered 2011-11-23 11:44:59 -0500

Can you add the catch_errors middleware like this :

https://review.openstack.org/#patch,u...

edit flag offensive delete link more
0

answered 2011-11-23 11:45:47 -0500

restart proxy and look over your /var/log/messages (depend of your distro) when doing that same curl requests.

edit flag offensive delete link more
0

answered 2011-11-23 12:01:27 -0500

change admin_token to keystone_admin_token

edit flag offensive delete link more
0

answered 2011-11-23 12:28:30 -0500

foexle gravatar image

ok i have checked out now the trunk version of keystone and installed it. I changed the attribute, too.

i try now curl -v -H 'X-Auth-Token: 30abaeac-b8dc-46f9-9aa1-db146c513099' http://192.168.0.2:8080/v1

and see in the logs:

Nov 23 13:27:45 test1-os swift Initialise keystone middleware (txn: txdc93b99128e548a890510aac2c7c77e0) Nov 23 13:27:45 test1-os swift Got token: 30abaeac-b8dc-46f9-9aa1-db146c513099 (txn: txdc93b99128e548a890510aac2c7c77e0) Nov 23 13:27:45 test1-os swift STDOUT: ERROR:root:Error talking to memcached: 192.168.0.2:11211#012Traceback (most recent call last):#012 File "/usr/lib/pymodules/python2.6/swift/common/memcached.py", line 160, in get#012 while line[0].upper() != 'END':#012IndexError: list index out of range (txn: txdc93b99128e548a890510aac2c7c77e0) Nov 23 13:27:45 test1-os swift No memcache, requesting it from keystone (txn: txdc93b99128e548a890510aac2c7c77e0) Nov 23 13:27:45 test1-os swift Error: http_connect_raw() got an unexpected keyword argument 'timeout': #012Traceback (most recent call last):#012 File "/usr/lib/pymodules/python2.6/swift/common/middleware/catch_errors.py", line 47, in __call__#012 return self.app(env, my_start_response)#012 File "/usr/lib/pymodules/python2.6/swift/common/middleware/memcache.py", line 32, in __call__#012 return self.app(env, start_response)#012 File "/usr/local/lib/python2.6/dist-packages/keystone-2012.1-py2.6.egg/keystone/middleware/swift_auth.py", line 109, in __call__#012 identity = self._keystone_validate_token(token)#012 File "/usr/local/lib/python2.6/dist-packages/keystone-2012.1-py2.6.egg/keystone/middleware/swift_auth.py", line 152, in _keystone_validate_token#012 timeout=self.auth_timeout)#012TypeError: http_connect_raw() got an unexpected keyword argument 'timeout' (txn: txdc93b99128e548a890510aac2c7c77e0)

Memcached are installad and running.

edit flag offensive delete link more
0

answered 2011-11-23 11:29:54 -0500

foexle gravatar image

hiho chmouel,

Swift: Version: 1.4.5~20111117.1632-0ubuntu0ppa1~lucid1

Keystone: Version was a stable from Razique. If i try with --version i get a hex, but i see the last file change was 2011-11-08. I hope this helps.

Greetings

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2011-11-23 10:29:14 -0500

Seen: 523 times

Last updated: Feb 24 '12