diff options
| author | Jamie Lennox <jamielennox@redhat.com> | 2014-02-19 15:35:46 +1000 |
|---|---|---|
| committer | Jamie Lennox <jamielennox@redhat.com> | 2014-06-23 07:19:52 +1000 |
| commit | 11336acf8868a2709cb583af9bbd8a1c442d137f (patch) | |
| tree | 6c01741fb976f2ff961bcbfe30d04989a7f52cf2 /keystoneclient/httpclient.py | |
| parent | 6c47b937c3c39f0fcb9dbfb7025d92b063671610 (diff) | |
| download | python-keystoneclient-11336acf8868a2709cb583af9bbd8a1c442d137f.tar.gz | |
Unversioned endpoints in service catalog
If you pass a version number to the endpoint_filter then an identity
plugin will make a request to the URL in the service catalog and find an
appropriate URL for the requested version.
It caches the response to each of the discovery queries so that it
should only query once per URL.
This will only work for applications that create session objects
directly as the legacy model does not use the get_endpoint features of
an identity plugin.
This change showed an inconsistency in the docstrings between discovery
and the usage of discovery so the docstring was fixed.
Blueprint: endpoint-version-query
Change-Id: I277f2f6ad6c8cd44f1a9c06cf07d62bc8f8b383b
Diffstat (limited to 'keystoneclient/httpclient.py')
| -rw-r--r-- | keystoneclient/httpclient.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/keystoneclient/httpclient.py b/keystoneclient/httpclient.py index 4c9bb24..474b8f6 100644 --- a/keystoneclient/httpclient.py +++ b/keystoneclient/httpclient.py @@ -55,6 +55,8 @@ request = client_session.request class HTTPClient(baseclient.Client, base.BaseAuthPlugin): + version = None + @utils.positional(enforcement=utils.positional.WARN) def __init__(self, username=None, tenant_id=None, tenant_name=None, password=None, auth_url=None, region_name=None, endpoint=None, @@ -568,11 +570,18 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin): concatenating self.management_url and url and passing in method and any associated kwargs. """ + # NOTE(jamielennox): remember that if you use the legacy client mode + # (you create a client without a session) then this HTTPClient object + # is the auth plugin you are using. Values in the endpoint_filter may + # be ignored and you should look at get_endpoint to figure out what. interface = 'admin' if management else 'public' endpoint_filter = kwargs.setdefault('endpoint_filter', {}) endpoint_filter.setdefault('service_type', 'identity') endpoint_filter.setdefault('interface', interface) + if self.version: + endpoint_filter.setdefault('version', self.version) + if self.region_name: endpoint_filter.setdefault('region_name', self.region_name) |
