Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X-OpenStack-Nova-API-Version header empty value #359

Closed
shoudusse opened this issue Jan 29, 2018 · 4 comments · Fixed by #367
Closed

X-OpenStack-Nova-API-Version header empty value #359

shoudusse opened this issue Jan 29, 2018 · 4 comments · Fixed by #367

Comments

@shoudusse
Copy link
Contributor

@shoudusse shoudusse commented Jan 29, 2018

My cloud provider only supports v2.0 compute API version.
If i request the version discovery, I have:

GET https://ecs.eu-west-0.prod-cloud-ocb.orange-business.com
{u'versions': [{u'id': u'v2.0',
                u'links': [{u'href': u'https://ecs.eu-west-0.prod-cloud-ocb.orange-business.com/v2/',
                            u'rel': u'self'}],
                u'min_version': u'',
                u'status': u'SUPPORTED',
                u'updated': u'2011-01-21T11:33:21Z',
                u'version': u''}]}

In this case, If I request the compute API, fog-openstack adds an X-OpenStack-Nova-API-Version HTTP header with an empty value.

Is it the wanted behaviour?

Thanks for your help.

@voelzmo

This comment has been minimized.

Copy link
Contributor

@voelzmo voelzmo commented Jan 30, 2018

@shoudusse

This comment has been minimized.

Copy link
Contributor Author

@shoudusse shoudusse commented Jan 30, 2018

Hello Marco

Actually, yes, it's causing me an issue as the WAF in front of the Cloud doesn't like this empty Header.
I took the lead opening this issue before asking the WAF team as they will probably answer me that an empty Header is not RFC 7230 compliant.
Regards,

@voelzmo

This comment has been minimized.

Copy link
Contributor

@voelzmo voelzmo commented Feb 2, 2018

Hey Sylvain,

it seems the method to extract the microversion from the nova API response doesn't deal well with an empty version being sent. It just uses whatever get_supported_microversions returns .

So I guess there is multiple options:

  • either get_supported_microversions should return nil when the versions property is present but empty
  • or set_microversion should ignore an empty string being returned from
    def self.get_supported_microversion(supported_versions, uri, auth_token, connection_options = {})
    supported_version = get_version(supported_versions, uri, auth_token, connection_options)
    supported_version['version'] if supported_version
    end
    get_supported_microversions and leave @microversion being nil
    @microversion = Fog::OpenStack.get_supported_microversion(
  • or setting the actual header should check not only for presence of @microversion but also if it is not empty string
    if @microversion
    microversion_value = if @microversion_key == 'Openstack-API-Version'
    "#{@microversion_service_type} #{@microversion}"
    else
    @microversion
    end
    microversion_header = {@microversion_key => microversion_value}
    additional_headers.merge!(microversion_header)
    end

@Carthaca wdyt?

@Carthaca

This comment has been minimized.

Copy link
Collaborator

@Carthaca Carthaca commented Feb 6, 2018

I would say the latter, checking if @microversion is not an empty string in the headers definition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.