[Openstack] Keystone Curl can't get tokens by credentials

Alessio Ababilov aababilov at griddynamics.com
Wed Jan 18 08:23:43 UTC 2012


Hi, Sean!

You know, swift seems to be not very intelligent :) There are two styles 
of authorization (v1.0 and v2.0) and swift doesn't try to guess the 
version from provided URL.

In your case, swift tried do send v1 query to keystone and retrieve URL 
from response header. Keystone doesn't set this header, so, url becomes 
None and you see `'NoneType' object has no attribute 'find'`. I've faced 
the same problem :)

The solution is as follows. You should set version explicitly (add -V 2.0).

Another problem I've faced is that you should give tenant name like 
this: -U customer-x:joeuser. Yes, it is yet another way to specify 
tenant. So, different CLI utilities (nova from novaclient, dumb keystone 
from keystoneclient, glance and swift) accept user/tenant/password/auth 
URL from different command line options and environment variables.

Conclusion: use this command:

swift -A http://127.0.0.1:5000/v2.0 -U customer-x:joeuser -K secrete -V 
2.0 stat -v


On 01/18/2012 05:48 AM, Xuyun Zhang wrote:
> Hi Alessio,
>
> Thank you for your help. Your answer solved the problem. I was really 
> confused by the different documents with different versions. It should 
> be v2.0.
>
> But after this step, I met another problem, when I ran "swift -A 
> http://127.0.0.1:5000/v2.0 -U joeuser -K secrete stat -v", I got the 
> following error message:
> Traceback (most recent call last):
>   File "/usr/bin/swift", line 1853, in <module>
>     error_queue)
>   File "/usr/bin/swift", line 1363, in st_stat
>     headers = conn.head_account()
>   File "/usr/bin/swift", line 818, in head_account
>     return self._retry(None, head_account)
>   File "/usr/bin/swift", line 790, in _retry
>     self.http_conn = self.http_connection()
> File "/usr/bin/swift", line 778, in http_connection
>
>     return http_connection(self.url)
>   File "/usr/bin/swift", line 163, in http_connection
>     parsed = urlparse(url)
>   File "/usr/lib/python2.7/urlparse.py", line 135, in urlparse
>     tuple = urlsplit(url, scheme, allow_fragments)
>   File "/usr/lib/python2.7/urlparse.py", line 174, in urlsplit
>     i = url.find(':')
> AttributeError: 'NoneType' object has no attribute 'find'
>
> I have found a answer online said "Keystone try to pick the tenant ID 
> from table "users" last variable which is tenant_id . if you did not 
> specify it , I think that keystone will return wrong URL for swift 
> client . try to associate a tenant for the user , and add an endpoint 
> for the tenant to swift endpoint templates." And this answer worked 
> for the guy who had this problem.
>
> But this solution haven't worked for me. I have created a user named 
> "joeuser", its tenant is "customer-x". And I also have created the 
> endpointTemplates, and added endpoints (swift endpoint is one) with 
> tenants (customer-x). (All are done by running the sampledata provided 
> by the keystone).
>
> The keystone api.log: WARNING [eventlet.wsgi.server] 127.0.0.1 -- 
> [18/Jan/2012 14:05:30] "GET /v2.0 HTTP/1.1" 200 1364 0.000522. (It 
> seemed nothing was wrong)
>
> I was totally confused when I fed the swift with wrong username and 
> password "swift -A http://127.0.0.1:5000/v2.0 -U asdf -K asdfasdf stat 
> -v", I got the same error message and the api.log showed the same log 
> message. So, it seemed that his problem may happen before authentication.
>
> So, could you please help with this problem? That must be highly 
> appreciated. I have got stuck here for several days.
>
> Other information: I used the tempauth for swift successfully and 
> created two containers and uploaded several files. So I think swift 
> works well. And the bug mentioned in the official documentation "note: 
> you currently have to create a container or upload something as your 
> first action to have the account created; there’s a Swift bug to be 
> fixed soon" may NOT affect my swift command. I also got error message 
> when I tried "swift -A http://127.0.0.1:5000/v2.0 -U asdf -K asdfasdf 
> post myfiles" ("myfiles" is a container I created before).
>
> Thank you so much for you help.
>
> Fine regards,
>
> Sean.
>

-- 
Alessio Ababilov
Software Engineer
Grid Dynamics





More information about the Openstack mailing list