fog-openstack
fog-openstack copied to clipboard
Fog::Image::OpenStack does not correctly construct URL for versioned API
My image endpoint is configured as http://glance.local:9292/ without an API version number, so Fog::Image::OpenStack uses Fog::OpenStack.get_supported_version to figure out the versioned API base URL by querying GET / on the Glance. This is the result returned from Glance (Kilo):
{
"versions": [
// various entries for v2.x omitted for brevity
{
"id": "v1.1",
"links": [
{
"href": "http://glance.local:9292/v1/",
"rel": "self"
}
],
"status": "SUPPORTED"
},
{
"id": "v1.0",
"links": [
{
"href": "http://glance.local:9292/v1/",
"rel": "self"
}
],
"status": "SUPPORTED"
}
]
}
The get_supported_version method decides that it likes the v1.1 version and returns that, but then Fog::Image::OpenSTack constructs the wrong URL in lib/fog/openstack/image.rb:206
@path = "/" + Fog::OpenStack.get_supported_version(SUPPORTED_VERSIONS,
uri,
@auth_token,
@connection_options)
This breaks because the URL path is /v1/ for the v1.1 API, not /v1.1/. Glance reports the correct URL in the response shown above, and that URL should be preferred over doing our own guesswork.
Original issue opened by @majewsky at fog/fog#3578
cc/ @majewsky @TerryHowe @tealover