ncw/swift

Swift info endpoint is not always the same

tcassaert opened this issue · 4 comments

When using Grafana Mimir with Swift (which uses an old version of this library), we encountered a problem with the /info endpoint.

At https://github.com/grafana/mimir/blob/mimir-2.11.0/vendor/github.com/ncw/swift/swift.go#L637 we see it always goes up 2 directories compared to the storageUrl.

In our case, the storageUrl is https://s3.waw3-1.cloudferro.com/swift/v1, so the /info endpoint becomes https://s3.waw3-1.cloudferro.com/info. This doesn't work for us as the /info endpoint is located at https://s3.waw3-1.cloudferro.com/swift/info.

I don't know enough about Swift to know if we have a Swift installation (not managed by us) with an unconventional /info endpoint?

A regular swift info (with the python client) seems to show the correct info, so that somehow finds the correct URL.

ncw commented

Do you fancy tracing the logic of the python program to see what it does?

ncw commented

According to the swift docs

https://docs.openstack.org/api-ref/object-store/

Your installation looks correct.

Totally not familiar with the codebase, but a quick search led me to https://github.com/openstack/python-swiftclient/blob/master/swiftclient/client.py#L1993-L2011 which seems to be covered by unit tests at https://github.com/openstack/python-swiftclient/blob/master/test/unit/test_swiftclient.py#L2081-L2125

Does that help in any way?

ncw commented

@tcassaert yes that is very useful. We could import those tests and check the info endpoint parser is correct (would probably need to factor it out into its own function first).

Do you want to have a go at that?