diff --git a/keystone/assignment/core.py b/keystone/assignment/core.py index 2795706934..90bb10aa79 100644 --- a/keystone/assignment/core.py +++ b/keystone/assignment/core.py @@ -26,6 +26,7 @@ from keystone.common import manager from keystone import config from keystone import exception from keystone.i18n import _ +from keystone.i18n import _LI from keystone import notifications from keystone.openstack.common import log @@ -259,8 +260,8 @@ class Manager(manager.Manager): tenant_id, config.CONF.member_role_id) except exception.RoleNotFound: - LOG.info(_("Creating the default role %s " - "because it does not exist."), + LOG.info(_LI("Creating the default role %s " + "because it does not exist."), config.CONF.member_role_id) role = {'id': CONF.member_role_id, 'name': CONF.member_role_name} diff --git a/keystone/catalog/backends/templated.py b/keystone/catalog/backends/templated.py index 36357085cb..1794414b60 100644 --- a/keystone/catalog/backends/templated.py +++ b/keystone/catalog/backends/templated.py @@ -20,7 +20,7 @@ from keystone.catalog.backends import kvs from keystone.catalog import core from keystone import config from keystone import exception -from keystone.i18n import _ +from keystone.i18n import _LC from keystone.openstack.common import log from keystone.openstack.common import versionutils @@ -103,7 +103,7 @@ class Catalog(kvs.Catalog): try: self.templates = parse_templates(open(template_file)) except IOError: - LOG.critical(_('Unable to open template file %s'), template_file) + LOG.critical(_LC('Unable to open template file %s'), template_file) raise def get_catalog(self, user_id, tenant_id, metadata=None): diff --git a/keystone/catalog/core.py b/keystone/catalog/core.py index 2b624f718f..b910389df1 100644 --- a/keystone/catalog/core.py +++ b/keystone/catalog/core.py @@ -26,6 +26,7 @@ from keystone.common import manager from keystone import config from keystone import exception from keystone.i18n import _ +from keystone.i18n import _LE from keystone import notifications from keystone.openstack.common import log @@ -52,19 +53,19 @@ def format_url(url, substitutions): {"url": url}) raise exception.MalformedEndpoint(endpoint=url) except KeyError as e: - LOG.error(_("Malformed endpoint %(url)s - unknown key %(keyerror)s"), + LOG.error(_LE("Malformed endpoint %(url)s - unknown key %(keyerror)s"), {"url": url, "keyerror": e}) raise exception.MalformedEndpoint(endpoint=url) except TypeError as e: - LOG.error(_("Malformed endpoint '%(url)s'. The following type error " - "occurred during string substitution: %(typeerror)s"), + LOG.error(_LE("Malformed endpoint '%(url)s'. The following type error " + "occurred during string substitution: %(typeerror)s"), {"url": url, "typeerror": e}) raise exception.MalformedEndpoint(endpoint=url) except ValueError as e: - LOG.error(_("Malformed endpoint %s - incomplete format " - "(are you missing a type notifier ?)"), url) + LOG.error(_LE("Malformed endpoint %s - incomplete format " + "(are you missing a type notifier ?)"), url) raise exception.MalformedEndpoint(endpoint=url) return result diff --git a/keystone/common/environment/eventlet_server.py b/keystone/common/environment/eventlet_server.py index 9a3bc82647..fa6d58f658 100644 --- a/keystone/common/environment/eventlet_server.py +++ b/keystone/common/environment/eventlet_server.py @@ -27,6 +27,8 @@ import eventlet.wsgi import greenlet from keystone.i18n import _ +from keystone.i18n import _LE +from keystone.i18n import _LI from keystone.openstack.common import log @@ -95,11 +97,11 @@ class Server(object): self.socket = eventlet.listen(info[-1], family=info[0], backlog=backlog) except EnvironmentError: - LOG.error(_("Could not bind to %(host)s:%(port)s"), + LOG.error(_LE("Could not bind to %(host)s:%(port)s"), {'host': self.host, 'port': self.port}) raise - LOG.info(_('Starting %(arg0)s on %(host)s:%(port)s'), + LOG.info(_LI('Starting %(arg0)s on %(host)s:%(port)s'), {'arg0': sys.argv[0], 'host': self.host, 'port': self.port}) diff --git a/keystone/common/kvs/core.py b/keystone/common/kvs/core.py index 12949c46f4..ea476cb8cf 100644 --- a/keystone/common/kvs/core.py +++ b/keystone/common/kvs/core.py @@ -27,6 +27,8 @@ import six from keystone.common import config from keystone import exception from keystone.i18n import _ +from keystone.i18n import _LI +from keystone.i18n import _LW from keystone.openstack.common import importutils from keystone.openstack.common import log @@ -129,11 +131,11 @@ class KeyValueStore(object): if issubclass(pxy, proxy.ProxyBackend): proxies.append(pxy) else: - LOG.warning(_('%s is not a dogpile.proxy.ProxyBackend'), + LOG.warning(_LW('%s is not a dogpile.proxy.ProxyBackend'), pxy.__name__) for proxy_cls in reversed(proxies): - LOG.info(_('Adding proxy \'%(proxy)s\' to KVS %(name)s.'), + LOG.info(_LI('Adding proxy \'%(proxy)s\' to KVS %(name)s.'), {'proxy': proxy_cls.__name__, 'name': self._region.name}) self._region.wrap(proxy_cls) @@ -183,7 +185,7 @@ class KeyValueStore(object): if CONF.kvs.enable_key_mangler: if key_mangler is not None: - msg = _('Using %(func)s as KVS region %(name)s key_mangler') + msg = _LI('Using %(func)s as KVS region %(name)s key_mangler') if callable(key_mangler): self._region.key_mangler = key_mangler LOG.info(msg, {'func': key_mangler.__name__, @@ -195,8 +197,8 @@ class KeyValueStore(object): raise exception.ValidationError( _('`key_mangler` option must be a function reference')) else: - LOG.info(_('Using default dogpile sha1_mangle_key as KVS ' - 'region %s key_mangler'), self._region.name) + LOG.info(_LI('Using default dogpile sha1_mangle_key as KVS ' + 'region %s key_mangler'), self._region.name) # NOTE(morganfainberg): Sane 'default' keymangler is the # dogpile sha1_mangle_key function. This ensures that unless # explicitly changed, we mangle keys. This helps to limit @@ -205,7 +207,7 @@ class KeyValueStore(object): self._region.key_mangler = dogpile_util.sha1_mangle_key self._set_keymangler_on_backend(self._region.key_mangler) else: - LOG.info(_('KVS region %s key_mangler disabled.'), + LOG.info(_LI('KVS region %s key_mangler disabled.'), self._region.name) self._set_keymangler_on_backend(None) @@ -396,7 +398,7 @@ class KeyValueStoreLock(object): if not self.expired: LOG.debug('KVS lock released for: %s', self.key) else: - LOG.warning(_('KVS lock released (timeout reached) for: %s'), + LOG.warning(_LW('KVS lock released (timeout reached) for: %s'), self.key) def __exit__(self, exc_type, exc_val, exc_tb): diff --git a/keystone/common/ldap/core.py b/keystone/common/ldap/core.py index ff726c0386..4fbc99b425 100644 --- a/keystone/common/ldap/core.py +++ b/keystone/common/ldap/core.py @@ -27,6 +27,7 @@ import six from keystone import exception from keystone.i18n import _ +from keystone.i18n import _LW from keystone.openstack.common import log LOG = log.getLogger(__name__) @@ -985,9 +986,9 @@ class KeystoneLDAPHandler(LDAPHandler): # Exit condition no more data on server break else: - LOG.warning(_('LDAP Server does not support paging. ' - 'Disable paging in keystone.conf to ' - 'avoid this message.')) + LOG.warning(_LW('LDAP Server does not support paging. ' + 'Disable paging in keystone.conf to ' + 'avoid this message.')) self._disable_paging() break return res @@ -1181,7 +1182,7 @@ class BaseLdap(object): try: ldap_attr, attr_map = item.split(':') except Exception: - LOG.warn(_( + LOG.warn(_LW( 'Invalid additional attribute mapping: "%s". ' 'Format must be :'), item) diff --git a/keystone/common/wsgi.py b/keystone/common/wsgi.py index c2542ec857..c068fc431a 100644 --- a/keystone/common/wsgi.py +++ b/keystone/common/wsgi.py @@ -31,6 +31,8 @@ from keystone.common import dependency from keystone.common import utils from keystone import exception from keystone.i18n import _ +from keystone.i18n import _LI +from keystone.i18n import _LW from keystone.models import token_model from keystone.openstack.common import importutils from keystone.openstack.common import jsonutils @@ -71,33 +73,34 @@ def validate_token_bind(context, token_ref): # no bind provided and none required return else: - LOG.info(_("No bind information present in token")) + LOG.info(_LI("No bind information present in token")) raise exception.Unauthorized() if name and name not in bind: - LOG.info(_("Named bind mode %s not in bind information"), name) + LOG.info(_LI("Named bind mode %s not in bind information"), name) raise exception.Unauthorized() for bind_type, identifier in six.iteritems(bind): if bind_type == 'kerberos': if not (context['environment'].get('AUTH_TYPE', '').lower() == 'negotiate'): - LOG.info(_("Kerberos credentials required and not present")) + LOG.info(_LI("Kerberos credentials required and not present")) raise exception.Unauthorized() if not context['environment'].get('REMOTE_USER') == identifier: - LOG.info(_("Kerberos credentials do not match those in bind")) + LOG.info(_LI("Kerberos credentials do not match " + "those in bind")) raise exception.Unauthorized() - LOG.info(_("Kerberos bind authentication successful")) + LOG.info(_LI("Kerberos bind authentication successful")) elif bind_mode == 'permissive': LOG.debug(("Ignoring unknown bind for permissive mode: " "{%(bind_type)s: %(identifier)s}"), {'bind_type': bind_type, 'identifier': identifier}) else: - LOG.info(_("Couldn't verify unknown bind: " - "{%(bind_type)s: %(identifier)s}"), + LOG.info(_LI("Couldn't verify unknown bind: " + "{%(bind_type)s: %(identifier)s}"), {'bind_type': bind_type, 'identifier': identifier}) raise exception.Unauthorized() @@ -220,7 +223,8 @@ class Application(BaseApplication): result = method(context, **params) except exception.Unauthorized as e: LOG.warning( - _('Authorization failed. %(exception)s from %(remote_addr)s'), + _LW("Authorization failed. %(exception)s from " + "%(remote_addr)s"), {'exception': e, 'remote_addr': req.environ['REMOTE_ADDR']}) return render_exception(e, context=context, user_locale=best_match_language(req)) @@ -339,7 +343,7 @@ class Application(BaseApplication): token_data = self.token_provider_api.validate_token( context['token_id']) except exception.TokenNotFound: - LOG.warning(_('Invalid token in _get_trust_id_for_request')) + LOG.warning(_LW('Invalid token in _get_trust_id_for_request')) raise exception.Unauthorized() token_ref = token_model.KeystoneToken(token_id=context['token_id'],