staticweb enabled container will not list json

Bug #1476789 reported by Adam Vinsh
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
Expired
Undecided
Unassigned

Bug Description

Running swift on Ubuntu 14.04 - 2.2.2-0ubuntu1~cloud0

When a container has static web enabled, the container listing comes back as html even with "?format=json"

This causes a swift client(version 2.3.1) to error as follows:

swift list OpenStackMetrics
Traceback (most recent call last):
  File "/usr/local/bin/swift", line 11, in <module>
    sys.exit(main())
  File "/Library/Python/2.7/site-packages/swiftclient/shell.py", line 1287, in main
    globals()['st_%s' % args[0]](parser, argv[1:], output)
  File "/Library/Python/2.7/site-packages/swiftclient/shell.py", line 458, in st_list
    raise stats["error"]

Setting static web off as follows stops this error:
swift post -v OpenStackMetrics -m web-listings:

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

I discovered that on a swift-all-in-one (with tempauth) providing a x-auth-token header caused the middleware to honor the format=json query string.

It may be worth nothing the reporter was running Keystone.

Revision history for this message
Hamdi Roumani (roumani) wrote :

I've tried to reproduce this by as of yet no luck, I'm using keystone as well.

With that said there's something that I'm not quite able to replicate.

Quick Tests with curl:

swift stat firstAclCont
          Account: AUTH_090ba1ae6d654be0adf512e047a1867d
        Container: firstAclCont
          Objects: 3
            Bytes: 37
         Read ACL: .r:*,.rlisting
        Write ACL:
          Sync To:
         Sync Key:
Meta Web-Listings: true

Curl on 'curl -i http://127.0.0.1:8080/v1/AUTH_b2c9f064ec32460eb487aca279a97d76/firstCont' returns 301 (this makes sense),

Using 'curl -i http://127.0.0.1:8080/v1/AUTH_b2c9f064ec32460eb487aca279a97d76/firstCont/' (notice the trailing slash and no auth-token) ... this returns HTML.

Curl with an auth_token always returns json data.

Now with the swift CLI we always generated an auth_token, and hence I'm always seeing JSON with keystone:
swift --debug list firstAclCont
DEBUG:keystoneclient.auth.identity.v2:Making authentication request to http://controller:35357/v2.0/tokens

DEBUG:swiftclient:REQ: curl -i http://0.0.0.0:8080/v1/AUTH_090ba1ae6d654be0adf512e047a1867d/firstAclCont?format=json -X GET -H "X-Auth-Token: ..."
... json ...

Note that when you see html it implies we didn't authentic and are making an anonymous request (and static web kicks in to provide the html listing).

The user above though, looking at the their swift client debug output:
http://paste.openstack.org/show/396366/

You can see the key is the first attempt at the URL hits 301 which causes it to redirect to <path>/

Whereas in my case this doesn't happen:
http://paste.openstack.org/show/404142/

I have a feeling there's something else in the ENV at play.

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

good effort! hopefully it's either so rare google will never bring someone to this page again, or someone else will run into it and be able to keep digging or find a correlation in the environmental details with the other observer.

... it happens.

Changed in swift:
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for OpenStack Object Storage (swift) because there has been no activity for 60 days.]

Changed in swift:
status: Incomplete → Expired
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.