Specifying an authurl without a version string gives unhelpful error

Bug #822940 reported by Jay Pipes
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
Fix Released
Undecided
Unassigned

Bug Description

Spent a long time today trying to understand why a simple swift.common.client.get_account() was raising:

'NoneType' object has no attribute 'find'

If you pass in an authurl like: auth.api.rackspacecloud.com, the Swift client produces the above unhelpful error message.

Reading the Cloud Files API docs gives the impression that the auth URL is auth.api.rackspacecloud.com, not auth.api.rackspacecloud.com/v1.0/, so I think it's conceivable that this might be a confusion for people. Having the Swift server respond with something like "Version required in authentication URL" might be useful and save folks some time trying to debug :)

Cheers,
jay

Revision history for this message
clayg (clay-gerrard) wrote : Re: [Bug 822940] [NEW] Specifying an authurl without a version string gives unhelpful error

On Mon, Aug 8, 2011 at 3:52 PM, Jay Pipes <email address hidden> wrote:

> Public bug reported:
>
> Spent a long time today trying to understand why a simple
> swift.common.client.get_account() was raising:
>
> 'NoneType' object has no attribute 'find'
>
> If you pass in an authurl like: auth.api.rackspacecloud.com, the Swift
> client produces the above unhelpful error message.
>
>
This is the result of a change in auth.api.rackspacecloud.com. With swauth,
or tempauth, this should raise a client error:

 In [1]: from swift.common.client import get_auth

In [2]: get_auth('http://<removed.stg.url>', 'asdf', 'asdf')
---------------------------------------------------------------------------
ClientException Traceback (most recent call last)

/home/clayg/workspace/swift/trunk/swift/common/<ipython console> in
<module>()

/home/clayg/workspace/swift/trunk/swift/common/client.pyc in get_auth(url,
user, key, snet)
    188 http_host=conn.host, http_port=conn.port,
    189 http_path=parsed.path, http_status=resp.status,
--> 190 http_reason=resp.reason)
    191 url = resp.getheader('x-storage-url')
    192 if snet:

ClientException: Auth GET failed: http://auth.stg.swift.racklabs.com:80 404
Not Found

In [3]: get_auth('https://api.mosso.com', 'asdf', 'asdf')
Out[3]: (None, None)

In [4]:

Revision history for this message
Jay Pipes (jaypipes) wrote :

Thanks for the response, Clay. So... is this not a bug, then? Or is it just specific to auth.api.rackspacecloud.com? If just a problem with auth.api.rackspacecloud.com, feel free to set it to Invalid...

Revision history for this message
clayg (clay-gerrard) wrote :

Maybe if get_auth has a successful return, but the x-storage-url and x-auth-token headers are missing we could raise an exception instead of returning the invalid (None, None).

My point was just that https://api.mosso.com used to 404 - now it has that 'api version map json' so perhaps client.py could be more skeptical about 200's from the "alleged" auth url.

Revision history for this message
Pete Zaitcev (zaitcev) wrote :

Looks like Chmouel fixed this by accident when he added -V 2 and split get_auth().

I tested it with both Keystone and swauth based Swift, it reports "Account not found". The Keystone version can hang if given some URLs, but I dunno...

Closing.

Changed in swift:
status: New → Confirmed
status: Confirmed → Fix Committed
Thierry Carrez (ttx)
Changed in swift:
milestone: none → 1.6.0
status: Fix Committed → Fix Released
Revision history for this message
clayg (clay-gerrard) wrote : clay.gerrard
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.