diff options
author | Tim Burke <tim.burke@gmail.com> | 2019-10-09 16:59:23 -0700 |
---|---|---|
committer | Tim Burke <tim.burke@gmail.com> | 2019-11-06 08:47:24 +0000 |
commit | c4bef14fc1975f2e115a6ec8560e674e8aa5b1bf (patch) | |
tree | 222191341ec8c908f9a0989dc8e9d79bbfac16c8 /swiftclient/authv1.py | |
parent | 1eda8f9f3eac55953b3d54e32754e2ec312ab348 (diff) | |
download | python-swiftclient-c4bef14fc1975f2e115a6ec8560e674e8aa5b1bf.tar.gz |
v1auth: support endpoint_data_for() api
...so we can be used with openstacksdk.
Also, add a few functests that use openstacksdk.
Change-Id: Ie6987f5de48914ec8932254cde79a973a0264877
Diffstat (limited to 'swiftclient/authv1.py')
-rw-r--r-- | swiftclient/authv1.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/swiftclient/authv1.py b/swiftclient/authv1.py index 55469ac..d70acac 100644 --- a/swiftclient/authv1.py +++ b/swiftclient/authv1.py @@ -45,6 +45,7 @@ from six.moves.urllib.parse import urljoin # Note that while we import keystoneauth1 here, we *don't* need to add it to # requirements.txt -- this entire module only makes sense (and should only be # loaded) if keystoneauth is already installed. +from keystoneauth1 import discover from keystoneauth1 import plugin from keystoneauth1 import exceptions from keystoneauth1 import loading @@ -110,11 +111,20 @@ class ServiceCatalogV1(object): ] def url_for(self, **kwargs): + return self.endpoint_data_for(**kwargs).url + + def endpoint_data_for(self, **kwargs): kwargs.setdefault('interface', 'public') kwargs.setdefault('service_type', None) if kwargs['service_type'] == 'object-store': - return self.storage_url + return discover.EndpointData( + service_type='object-store', + service_name='swift', + interface=kwargs['interface'], + region_name='default', + catalog_url=self.storage_url, + ) # Although our "catalog" includes an identity entry, nothing that uses # url_for() (including `openstack endpoint list`) will know what to do |