summaryrefslogtreecommitdiff
path: root/keystoneclient
diff options
context:
space:
mode:
authorJamie Lennox <jamielennox@gmail.com>2016-08-24 17:37:07 +1000
committerJamie Lennox <jamielennox@gmail.com>2016-08-24 18:52:36 +1000
commitf557170404ec2b7f5c562e55ad212b6e444655c8 (patch)
treead5dde2988ffd86e56c0194a772f2a77c5abdf23 /keystoneclient
parent4b8158f9b499646aa80dadf8594a9efa4ef57b14 (diff)
downloadpython-keystoneclient-f557170404ec2b7f5c562e55ad212b6e444655c8.tar.gz
Use AUTH_INTERFACE object from keystoneauth
As keystoneclient and other services rely more on keystoneauth we should assume that keystoneauth is our base auth library, not keystoneclient and start to default to the objects provided from there. This will make it easier to remove these objects when the time comes. Use the AUTH_INTERFACE special object from keystoneauth in most places. This uses it everywhere that is actually session independant. For example it is not changed within the keystoneclient auth plugins themselves as they are directly compatible with keystoneauth. Change-Id: Ibc1224fca98c852106feb78c624b0b2f22b3a19d
Diffstat (limited to 'keystoneclient')
-rw-r--r--keystoneclient/base.py4
-rw-r--r--keystoneclient/discover.py4
-rw-r--r--keystoneclient/tests/unit/auth/test_access.py8
-rw-r--r--keystoneclient/tests/unit/auth/test_identity_common.py5
-rw-r--r--keystoneclient/v2_0/tenants.py4
-rw-r--r--keystoneclient/v2_0/tokens.py4
-rw-r--r--keystoneclient/v3/auth.py7
-rw-r--r--keystoneclient/v3/contrib/federation/base.py4
-rw-r--r--keystoneclient/v3/contrib/oauth1/access_tokens.py5
-rw-r--r--keystoneclient/v3/contrib/oauth1/request_tokens.py4
10 files changed, 26 insertions, 23 deletions
diff --git a/keystoneclient/base.py b/keystoneclient/base.py
index 3f13a6c..fc16298 100644
--- a/keystoneclient/base.py
+++ b/keystoneclient/base.py
@@ -22,11 +22,11 @@ import copy
import functools
import warnings
+from keystoneauth1 import plugin
from oslo_utils import strutils
import six
from six.moves import urllib
-from keystoneclient import auth
from keystoneclient import exceptions
from keystoneclient.i18n import _
@@ -389,7 +389,7 @@ class CrudManager(Manager):
return self._list(
url_query,
self.collection_key,
- endpoint_filter={'interface': auth.AUTH_INTERFACE})
+ endpoint_filter={'interface': plugin.AUTH_INTERFACE})
else:
raise
diff --git a/keystoneclient/discover.py b/keystoneclient/discover.py
index d316fdc..85b0875 100644
--- a/keystoneclient/discover.py
+++ b/keystoneclient/discover.py
@@ -14,11 +14,11 @@ import logging
import warnings
from debtcollector import removals
+from keystoneauth1 import plugin
from positional import positional
import six
from keystoneclient import _discover
-from keystoneclient.auth import base
from keystoneclient import exceptions
from keystoneclient.i18n import _
from keystoneclient import session as client_session
@@ -173,7 +173,7 @@ class Discover(_discover.Discover):
url = auth_url
elif session.auth:
self._use_endpoint = False
- url = session.get_endpoint(interface=base.AUTH_INTERFACE)
+ url = session.get_endpoint(interface=plugin.AUTH_INTERFACE)
if not url:
raise exceptions.DiscoveryFailure(
diff --git a/keystoneclient/tests/unit/auth/test_access.py b/keystoneclient/tests/unit/auth/test_access.py
index 640fb7d..f5f5843 100644
--- a/keystoneclient/tests/unit/auth/test_access.py
+++ b/keystoneclient/tests/unit/auth/test_access.py
@@ -13,9 +13,9 @@
import uuid
from keystoneauth1 import fixture
+from keystoneauth1 import plugin
from keystoneclient import access
-from keystoneclient import auth
from keystoneclient.auth.identity import access as access_plugin
from keystoneclient import session
from keystoneclient.tests.unit import utils
@@ -49,11 +49,11 @@ class AccessInfoPluginTests(utils.TestCase):
def test_auth_url(self):
auth_url = 'http://keystone.test.url'
- plugin = self._plugin(auth_url=auth_url)
+ plug = self._plugin(auth_url=auth_url)
self.assertEqual(auth_url,
- plugin.get_endpoint(self.session,
- interface=auth.AUTH_INTERFACE))
+ plug.get_endpoint(self.session,
+ interface=plugin.AUTH_INTERFACE))
def test_invalidate(self):
plugin = self._plugin()
diff --git a/keystoneclient/tests/unit/auth/test_identity_common.py b/keystoneclient/tests/unit/auth/test_identity_common.py
index 9fb0357..5793672 100644
--- a/keystoneclient/tests/unit/auth/test_identity_common.py
+++ b/keystoneclient/tests/unit/auth/test_identity_common.py
@@ -15,6 +15,7 @@ import datetime
import uuid
from keystoneauth1 import fixture
+from keystoneauth1 import plugin
import mock
from oslo_utils import timeutils
import six
@@ -191,7 +192,7 @@ class CommonIdentityTests(object):
s = session.Session(auth=a)
auth_url = s.get_endpoint(service_type='compute',
- interface=base.AUTH_INTERFACE)
+ interface=plugin.AUTH_INTERFACE)
self.assertEqual(self.TEST_URL, auth_url)
@@ -402,7 +403,7 @@ class CatalogHackTests(utils.TestCase):
sess = session.Session(auth=v2_auth)
- endpoint = sess.get_endpoint(interface=base.AUTH_INTERFACE,
+ endpoint = sess.get_endpoint(interface=plugin.AUTH_INTERFACE,
version=(3, 0))
self.assertEqual(self.V3_URL, endpoint)
diff --git a/keystoneclient/v2_0/tenants.py b/keystoneclient/v2_0/tenants.py
index ff40aca..d375da6 100644
--- a/keystoneclient/v2_0/tenants.py
+++ b/keystoneclient/v2_0/tenants.py
@@ -14,10 +14,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from keystoneauth1 import plugin
import six
from six.moves import urllib
-from keystoneclient import auth
from keystoneclient import base
from keystoneclient import exceptions
@@ -124,7 +124,7 @@ class TenantManager(base.ManagerWithFind):
try:
tenant_list = self._list('/tenants%s' % query, 'tenants')
except exceptions.EndpointNotFound:
- endpoint_filter = {'interface': auth.AUTH_INTERFACE}
+ endpoint_filter = {'interface': plugin.AUTH_INTERFACE}
tenant_list = self._list('/tenants%s' % query, 'tenants',
endpoint_filter=endpoint_filter)
diff --git a/keystoneclient/v2_0/tokens.py b/keystoneclient/v2_0/tokens.py
index 2e18507..b5f9657 100644
--- a/keystoneclient/v2_0/tokens.py
+++ b/keystoneclient/v2_0/tokens.py
@@ -10,10 +10,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from keystoneauth1 import plugin
from positional import positional
from keystoneclient import access
-from keystoneclient import auth
from keystoneclient import base
from keystoneclient import exceptions
from keystoneclient.i18n import _
@@ -65,7 +65,7 @@ class TokenManager(base.Manager):
try:
token_ref = self._post(*args, **kwargs)
except exceptions.EndpointNotFound:
- kwargs['endpoint_filter'] = {'interface': auth.AUTH_INTERFACE}
+ kwargs['endpoint_filter'] = {'interface': plugin.AUTH_INTERFACE}
token_ref = self._post(*args, **kwargs)
return token_ref
diff --git a/keystoneclient/v3/auth.py b/keystoneclient/v3/auth.py
index caad4ac..6272dbc 100644
--- a/keystoneclient/v3/auth.py
+++ b/keystoneclient/v3/auth.py
@@ -10,7 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-from keystoneclient import auth
+from keystoneauth1 import plugin
+
from keystoneclient import base
from keystoneclient import exceptions
from keystoneclient.v3 import domains
@@ -43,7 +44,7 @@ class AuthManager(base.Manager):
'projects',
obj_class=Project)
except exceptions.EndpointNotFound:
- endpoint_filter = {'interface': auth.AUTH_INTERFACE}
+ endpoint_filter = {'interface': plugin.AUTH_INTERFACE}
return self._list(self._PROJECTS_URL,
'projects',
obj_class=Project,
@@ -61,7 +62,7 @@ class AuthManager(base.Manager):
'domains',
obj_class=Domain)
except exceptions.EndpointNotFound:
- endpoint_filter = {'interface': auth.AUTH_INTERFACE}
+ endpoint_filter = {'interface': plugin.AUTH_INTERFACE}
return self._list(self._DOMAINS_URL,
'domains',
obj_class=Domain,
diff --git a/keystoneclient/v3/contrib/federation/base.py b/keystoneclient/v3/contrib/federation/base.py
index 99c8d5a..5e2e9e7 100644
--- a/keystoneclient/v3/contrib/federation/base.py
+++ b/keystoneclient/v3/contrib/federation/base.py
@@ -12,9 +12,9 @@
import abc
+from keystoneauth1 import plugin
import six
-from keystoneclient.auth import base as base_auth
from keystoneclient import base
from keystoneclient import exceptions
@@ -34,7 +34,7 @@ class EntityManager(base.Manager):
try:
tenant_list = self._list(url, self.object_type)
except exceptions.EndpointException:
- endpoint_filter = {'interface': base_auth.AUTH_INTERFACE}
+ endpoint_filter = {'interface': plugin.AUTH_INTERFACE}
tenant_list = self._list(url, self.object_type,
endpoint_filter=endpoint_filter)
return tenant_list
diff --git a/keystoneclient/v3/contrib/oauth1/access_tokens.py b/keystoneclient/v3/contrib/oauth1/access_tokens.py
index b2d0e31..37f1941 100644
--- a/keystoneclient/v3/contrib/oauth1/access_tokens.py
+++ b/keystoneclient/v3/contrib/oauth1/access_tokens.py
@@ -13,7 +13,8 @@
from __future__ import unicode_literals
-from keystoneclient import auth
+from keystoneauth1 import plugin
+
from keystoneclient import base
from keystoneclient.v3.contrib.oauth1 import utils
@@ -41,7 +42,7 @@ class AccessTokenManager(base.CrudManager):
resource_owner_secret=request_secret,
signature_method=oauth1.SIGNATURE_HMAC,
verifier=verifier)
- url = self.client.get_endpoint(interface=auth.AUTH_INTERFACE).rstrip(
+ url = self.client.get_endpoint(interface=plugin.AUTH_INTERFACE).rstrip(
'/')
url, headers, body = oauth_client.sign(url + endpoint,
http_method='POST')
diff --git a/keystoneclient/v3/contrib/oauth1/request_tokens.py b/keystoneclient/v3/contrib/oauth1/request_tokens.py
index b33dd2e..59f06bc 100644
--- a/keystoneclient/v3/contrib/oauth1/request_tokens.py
+++ b/keystoneclient/v3/contrib/oauth1/request_tokens.py
@@ -13,9 +13,9 @@
from __future__ import unicode_literals
+from keystoneauth1 import plugin
from six.moves.urllib import parse as urlparse
-from keystoneclient import auth
from keystoneclient import base
from keystoneclient.v3.contrib.oauth1 import utils
@@ -63,7 +63,7 @@ class RequestTokenManager(base.CrudManager):
client_secret=consumer_secret,
signature_method=oauth1.SIGNATURE_HMAC,
callback_uri="oob")
- url = self.client.get_endpoint(interface=auth.AUTH_INTERFACE).rstrip(
+ url = self.client.get_endpoint(interface=plugin.AUTH_INTERFACE).rstrip(
"/")
url, headers, body = oauth_client.sign(url + endpoint,
http_method='POST',