diff options
| author | Jamie Lennox <jamielennox@redhat.com> | 2014-12-22 11:03:07 +1000 |
|---|---|---|
| committer | Jamie Lennox <jamielennox@redhat.com> | 2014-12-22 11:04:11 +1000 |
| commit | 530bb4fa4328f9490b048cc61c569be1ce2fe602 (patch) | |
| tree | 3c5fcb0dbbce0fd8c46f67870cbef372b3ac5917 /keystoneclient/auth | |
| parent | 10860db5f155052ca0d353ce9058e1c16eec8437 (diff) | |
| download | python-keystoneclient-530bb4fa4328f9490b048cc61c569be1ce2fe602.tar.gz | |
Reference identity plugins from __init__.py
Add the identity plugins to the __init__.py so they can be used without
specifically importing the v2, v3 or generic files.
This changes some usages of keystoneclient.discover to
keystoneclient._discover as the generic plugins are available at the
same time as other versioned plugins when keystoneclient.Client is
imported. This is the reason we have _discover in the first place.
Change-Id: I7b9bbc123aeac11d22b3a58395391d01af0427eb
Diffstat (limited to 'keystoneclient/auth')
| -rw-r--r-- | keystoneclient/auth/identity/__init__.py | 37 | ||||
| -rw-r--r-- | keystoneclient/auth/identity/generic/base.py | 4 | ||||
| -rw-r--r-- | keystoneclient/auth/identity/generic/password.py | 6 | ||||
| -rw-r--r-- | keystoneclient/auth/identity/generic/token.py | 6 |
4 files changed, 45 insertions, 8 deletions
diff --git a/keystoneclient/auth/identity/__init__.py b/keystoneclient/auth/identity/__init__.py index e69de29..d2aca8f 100644 --- a/keystoneclient/auth/identity/__init__.py +++ b/keystoneclient/auth/identity/__init__.py @@ -0,0 +1,37 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from keystoneclient.auth.identity import base +from keystoneclient.auth.identity import generic +from keystoneclient.auth.identity import v2 +from keystoneclient.auth.identity import v3 + + +BaseIdentityPlugin = base.BaseIdentityPlugin + +V2Password = v2.Password +V2Token = v2.Token + +V3Password = v3.Password +V3Token = v3.Token + +Password = generic.Password +Token = generic.Token + + +__all__ = ['BaseIdentityPlugin', + 'Password', + 'Token', + 'V2Password', + 'V2Token', + 'V3Password', + 'V3Token'] diff --git a/keystoneclient/auth/identity/generic/base.py b/keystoneclient/auth/identity/generic/base.py index 4fa3c9c..6b1aceb 100644 --- a/keystoneclient/auth/identity/generic/base.py +++ b/keystoneclient/auth/identity/generic/base.py @@ -17,8 +17,8 @@ from oslo.config import cfg import six import six.moves.urllib.parse as urlparse +from keystoneclient import _discover from keystoneclient.auth.identity import base -from keystoneclient import discover from keystoneclient import exceptions from keystoneclient.i18n import _, _LW @@ -147,7 +147,7 @@ class BaseGenericPlugin(base.BaseIdentityPlugin): for data in disc_data: version = data['version'] - if (discover.version_match((2,), version) and + if (_discover.version_match((2,), version) and self._has_domain_scope): # NOTE(jamielennox): if there are domain parameters there # is no point even trying against v2 APIs. diff --git a/keystoneclient/auth/identity/generic/password.py b/keystoneclient/auth/identity/generic/password.py index 724a3cd..ce5a6d2 100644 --- a/keystoneclient/auth/identity/generic/password.py +++ b/keystoneclient/auth/identity/generic/password.py @@ -14,10 +14,10 @@ import logging from oslo.config import cfg +from keystoneclient import _discover from keystoneclient.auth.identity.generic import base from keystoneclient.auth.identity import v2 from keystoneclient.auth.identity import v3 -from keystoneclient import discover from keystoneclient import utils LOG = logging.getLogger(__name__) @@ -57,7 +57,7 @@ class Password(base.BaseGenericPlugin): self._user_domain_name = user_domain_name def create_plugin(self, session, version, url, raw_status=None): - if discover.version_match((2,), version): + if _discover.version_match((2,), version): if self._user_domain_id or self._user_domain_name: # If you specify any domain parameters it won't work so quit. return None @@ -68,7 +68,7 @@ class Password(base.BaseGenericPlugin): password=self._password, **self._v2_params) - elif discover.version_match((3,), version): + elif _discover.version_match((3,), version): return v3.Password(auth_url=url, user_id=self._user_id, username=self._username, diff --git a/keystoneclient/auth/identity/generic/token.py b/keystoneclient/auth/identity/generic/token.py index 7d05ca4..d309dfa 100644 --- a/keystoneclient/auth/identity/generic/token.py +++ b/keystoneclient/auth/identity/generic/token.py @@ -14,10 +14,10 @@ import logging from oslo.config import cfg +from keystoneclient import _discover from keystoneclient.auth.identity.generic import base from keystoneclient.auth.identity import v2 from keystoneclient.auth.identity import v3 -from keystoneclient import discover LOG = logging.getLogger(__name__) @@ -39,10 +39,10 @@ class Token(base.BaseGenericPlugin): self._token = token def create_plugin(self, session, version, url, raw_status=None): - if discover.version_match((2,), version): + if _discover.version_match((2,), version): return v2.Token(url, self._token, **self._v2_params) - elif discover.version_match((3,), version): + elif _discover.version_match((3,), version): return v3.Token(url, self._token, **self._v3_params) @classmethod |
