diff options
Diffstat (limited to 'keystoneclient/auth')
-rw-r--r-- | keystoneclient/auth/base.py | 4 | ||||
-rw-r--r-- | keystoneclient/auth/identity/base.py | 12 | ||||
-rw-r--r-- | keystoneclient/auth/identity/generic/base.py | 10 | ||||
-rw-r--r-- | keystoneclient/auth/identity/v3.py | 14 |
4 files changed, 23 insertions, 17 deletions
diff --git a/keystoneclient/auth/base.py b/keystoneclient/auth/base.py index 66e6a18..fda9d9a 100644 --- a/keystoneclient/auth/base.py +++ b/keystoneclient/auth/base.py @@ -17,6 +17,8 @@ import six import stevedore from keystoneclient import exceptions +from keystoneclient.i18n import _ + # NOTE(jamielennox): The AUTH_INTERFACE is a special value that can be # requested from get_endpoint. If a plugin receives this as the value of @@ -40,7 +42,7 @@ def get_plugin_class(name): name=name, invoke_on_load=False) except RuntimeError: - msg = 'The plugin %s could not be found' % name + msg = _('The plugin %s could not be found') % name raise exceptions.NoMatchingPlugin(msg) return mgr.driver diff --git a/keystoneclient/auth/identity/base.py b/keystoneclient/auth/identity/base.py index a58de2a..aae24c3 100644 --- a/keystoneclient/auth/identity/base.py +++ b/keystoneclient/auth/identity/base.py @@ -19,6 +19,7 @@ import six from keystoneclient import _discover from keystoneclient.auth import base from keystoneclient import exceptions +from keystoneclient.i18n import _LW from keystoneclient import utils LOG = logging.getLogger(__name__) @@ -181,9 +182,9 @@ class BaseIdentityPlugin(base.BaseAuthPlugin): return self.auth_url if not service_type: - LOG.warn('Plugin cannot return an endpoint without knowing the ' - 'service type that is required. Add service_type to ' - 'endpoint filtering data.') + LOG.warn(_LW('Plugin cannot return an endpoint without knowing ' + 'the service type that is required. Add service_type ' + 'to endpoint filtering data.')) return None if not interface: @@ -216,8 +217,9 @@ class BaseIdentityPlugin(base.BaseAuthPlugin): # NOTE(jamielennox): Again if we can't contact the server we fall # back to just returning the URL from the catalog. This may not be # the best default but we need it for now. - LOG.warn('Failed to contact the endpoint at %s for discovery. ' - 'Fallback to using that endpoint as the base url.', url) + LOG.warn(_LW('Failed to contact the endpoint at %s for discovery. ' + 'Fallback to using that endpoint as the base url.'), + url) else: url = disc.url_for(version) diff --git a/keystoneclient/auth/identity/generic/base.py b/keystoneclient/auth/identity/generic/base.py index 94d48ec..631eebd 100644 --- a/keystoneclient/auth/identity/generic/base.py +++ b/keystoneclient/auth/identity/generic/base.py @@ -20,6 +20,8 @@ import six.moves.urllib.parse as urlparse from keystoneclient import _discover from keystoneclient.auth.identity import base from keystoneclient import exceptions +from keystoneclient.i18n import _, _LW + LOG = logging.getLogger(__name__) @@ -127,9 +129,9 @@ class BaseGenericPlugin(base.BaseIdentityPlugin): except (exceptions.DiscoveryFailure, exceptions.HTTPError, exceptions.ConnectionError): - LOG.warn('Discovering versions from the identity service failed ' - 'when creating the password plugin. Attempting to ' - 'determine version from URL.') + LOG.warn(_LW('Discovering versions from the identity service ' + 'failed when creating the password plugin. ' + 'Attempting to determine version from URL.')) url_parts = urlparse.urlparse(self.auth_url) path = url_parts.path.lower() @@ -163,7 +165,7 @@ class BaseGenericPlugin(base.BaseIdentityPlugin): return plugin # so there were no URLs that i could use for auth of any version. - msg = 'Could not determine a suitable URL for the plugin' + msg = _('Could not determine a suitable URL for the plugin') raise exceptions.DiscoveryFailure(msg) def get_auth_ref(self, session, **kwargs): diff --git a/keystoneclient/auth/identity/v3.py b/keystoneclient/auth/identity/v3.py index 99d7562..e0f6b08 100644 --- a/keystoneclient/auth/identity/v3.py +++ b/keystoneclient/auth/identity/v3.py @@ -19,6 +19,7 @@ import six from keystoneclient import access from keystoneclient.auth.identity import base from keystoneclient import exceptions +from keystoneclient.i18n import _ from keystoneclient import utils _logger = logging.getLogger(__name__) @@ -84,18 +85,17 @@ class Auth(base.BaseIdentityPlugin): ident[name] = auth_data if not ident: - raise exceptions.AuthorizationFailure('Authentication method ' - 'required (e.g. password)') + raise exceptions.AuthorizationFailure( + _('Authentication method required (e.g. password)')) mutual_exclusion = [bool(self.domain_id or self.domain_name), bool(self.project_id or self.project_name), bool(self.trust_id)] if sum(mutual_exclusion) > 1: - raise exceptions.AuthorizationFailure('Authentication cannot be ' - 'scoped to multiple ' - 'targets. Pick one of: ' - 'project, domain or trust') + raise exceptions.AuthorizationFailure( + _('Authentication cannot be scoped to multiple targets. Pick ' + 'one of: project, domain or trust')) if self.domain_id: body['auth']['scope'] = {'domain': {'id': self.domain_id}} @@ -165,7 +165,7 @@ class AuthMethod(object): setattr(self, param, kwargs.pop(param, None)) if kwargs: - msg = "Unexpected Attributes: %s" % ", ".join(kwargs.keys()) + msg = _("Unexpected Attributes: %s") % ", ".join(kwargs.keys()) raise AttributeError(msg) @classmethod |