Merge "add missing log hints for level C/E/I/W"

This commit is contained in:
Jenkins 2014-08-31 08:33:02 +00:00 committed by Gerrit Code Review
commit 06676f6d9e
7 changed files with 42 additions and 31 deletions

View File

@ -26,6 +26,7 @@ from keystone.common import manager
from keystone import config from keystone import config
from keystone import exception from keystone import exception
from keystone.i18n import _ from keystone.i18n import _
from keystone.i18n import _LI
from keystone import notifications from keystone import notifications
from keystone.openstack.common import log from keystone.openstack.common import log
@ -259,7 +260,7 @@ class Manager(manager.Manager):
tenant_id, tenant_id,
config.CONF.member_role_id) config.CONF.member_role_id)
except exception.RoleNotFound: except exception.RoleNotFound:
LOG.info(_("Creating the default role %s " LOG.info(_LI("Creating the default role %s "
"because it does not exist."), "because it does not exist."),
config.CONF.member_role_id) config.CONF.member_role_id)
role = {'id': CONF.member_role_id, role = {'id': CONF.member_role_id,

View File

@ -20,7 +20,7 @@ from keystone.catalog.backends import kvs
from keystone.catalog import core from keystone.catalog import core
from keystone import config from keystone import config
from keystone import exception from keystone import exception
from keystone.i18n import _ from keystone.i18n import _LC
from keystone.openstack.common import log from keystone.openstack.common import log
from keystone.openstack.common import versionutils from keystone.openstack.common import versionutils
@ -103,7 +103,7 @@ class Catalog(kvs.Catalog):
try: try:
self.templates = parse_templates(open(template_file)) self.templates = parse_templates(open(template_file))
except IOError: except IOError:
LOG.critical(_('Unable to open template file %s'), template_file) LOG.critical(_LC('Unable to open template file %s'), template_file)
raise raise
def get_catalog(self, user_id, tenant_id, metadata=None): def get_catalog(self, user_id, tenant_id, metadata=None):

View File

@ -26,6 +26,7 @@ from keystone.common import manager
from keystone import config from keystone import config
from keystone import exception from keystone import exception
from keystone.i18n import _ from keystone.i18n import _
from keystone.i18n import _LE
from keystone import notifications from keystone import notifications
from keystone.openstack.common import log from keystone.openstack.common import log
@ -52,18 +53,18 @@ def format_url(url, substitutions):
{"url": url}) {"url": url})
raise exception.MalformedEndpoint(endpoint=url) raise exception.MalformedEndpoint(endpoint=url)
except KeyError as e: 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, {"url": url,
"keyerror": e}) "keyerror": e})
raise exception.MalformedEndpoint(endpoint=url) raise exception.MalformedEndpoint(endpoint=url)
except TypeError as e: except TypeError as e:
LOG.error(_("Malformed endpoint '%(url)s'. The following type error " LOG.error(_LE("Malformed endpoint '%(url)s'. The following type error "
"occurred during string substitution: %(typeerror)s"), "occurred during string substitution: %(typeerror)s"),
{"url": url, {"url": url,
"typeerror": e}) "typeerror": e})
raise exception.MalformedEndpoint(endpoint=url) raise exception.MalformedEndpoint(endpoint=url)
except ValueError as e: except ValueError as e:
LOG.error(_("Malformed endpoint %s - incomplete format " LOG.error(_LE("Malformed endpoint %s - incomplete format "
"(are you missing a type notifier ?)"), url) "(are you missing a type notifier ?)"), url)
raise exception.MalformedEndpoint(endpoint=url) raise exception.MalformedEndpoint(endpoint=url)
return result return result

View File

@ -27,6 +27,8 @@ import eventlet.wsgi
import greenlet import greenlet
from keystone.i18n import _ from keystone.i18n import _
from keystone.i18n import _LE
from keystone.i18n import _LI
from keystone.openstack.common import log from keystone.openstack.common import log
@ -95,11 +97,11 @@ class Server(object):
self.socket = eventlet.listen(info[-1], family=info[0], self.socket = eventlet.listen(info[-1], family=info[0],
backlog=backlog) backlog=backlog)
except EnvironmentError: 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}) {'host': self.host, 'port': self.port})
raise 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], {'arg0': sys.argv[0],
'host': self.host, 'host': self.host,
'port': self.port}) 'port': self.port})

View File

@ -27,6 +27,8 @@ import six
from keystone.common import config from keystone.common import config
from keystone import exception from keystone import exception
from keystone.i18n import _ 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 importutils
from keystone.openstack.common import log from keystone.openstack.common import log
@ -129,11 +131,11 @@ class KeyValueStore(object):
if issubclass(pxy, proxy.ProxyBackend): if issubclass(pxy, proxy.ProxyBackend):
proxies.append(pxy) proxies.append(pxy)
else: else:
LOG.warning(_('%s is not a dogpile.proxy.ProxyBackend'), LOG.warning(_LW('%s is not a dogpile.proxy.ProxyBackend'),
pxy.__name__) pxy.__name__)
for proxy_cls in reversed(proxies): 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__, {'proxy': proxy_cls.__name__,
'name': self._region.name}) 'name': self._region.name})
self._region.wrap(proxy_cls) self._region.wrap(proxy_cls)
@ -183,7 +185,7 @@ class KeyValueStore(object):
if CONF.kvs.enable_key_mangler: if CONF.kvs.enable_key_mangler:
if key_mangler is not None: 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): if callable(key_mangler):
self._region.key_mangler = key_mangler self._region.key_mangler = key_mangler
LOG.info(msg, {'func': key_mangler.__name__, LOG.info(msg, {'func': key_mangler.__name__,
@ -195,7 +197,7 @@ class KeyValueStore(object):
raise exception.ValidationError( raise exception.ValidationError(
_('`key_mangler` option must be a function reference')) _('`key_mangler` option must be a function reference'))
else: else:
LOG.info(_('Using default dogpile sha1_mangle_key as KVS ' LOG.info(_LI('Using default dogpile sha1_mangle_key as KVS '
'region %s key_mangler'), self._region.name) 'region %s key_mangler'), self._region.name)
# NOTE(morganfainberg): Sane 'default' keymangler is the # NOTE(morganfainberg): Sane 'default' keymangler is the
# dogpile sha1_mangle_key function. This ensures that unless # dogpile sha1_mangle_key function. This ensures that unless
@ -205,7 +207,7 @@ class KeyValueStore(object):
self._region.key_mangler = dogpile_util.sha1_mangle_key self._region.key_mangler = dogpile_util.sha1_mangle_key
self._set_keymangler_on_backend(self._region.key_mangler) self._set_keymangler_on_backend(self._region.key_mangler)
else: else:
LOG.info(_('KVS region %s key_mangler disabled.'), LOG.info(_LI('KVS region %s key_mangler disabled.'),
self._region.name) self._region.name)
self._set_keymangler_on_backend(None) self._set_keymangler_on_backend(None)
@ -396,7 +398,7 @@ class KeyValueStoreLock(object):
if not self.expired: if not self.expired:
LOG.debug('KVS lock released for: %s', self.key) LOG.debug('KVS lock released for: %s', self.key)
else: else:
LOG.warning(_('KVS lock released (timeout reached) for: %s'), LOG.warning(_LW('KVS lock released (timeout reached) for: %s'),
self.key) self.key)
def __exit__(self, exc_type, exc_val, exc_tb): def __exit__(self, exc_type, exc_val, exc_tb):

View File

@ -27,6 +27,7 @@ import six
from keystone import exception from keystone import exception
from keystone.i18n import _ from keystone.i18n import _
from keystone.i18n import _LW
from keystone.openstack.common import log from keystone.openstack.common import log
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
@ -985,7 +986,7 @@ class KeystoneLDAPHandler(LDAPHandler):
# Exit condition no more data on server # Exit condition no more data on server
break break
else: else:
LOG.warning(_('LDAP Server does not support paging. ' LOG.warning(_LW('LDAP Server does not support paging. '
'Disable paging in keystone.conf to ' 'Disable paging in keystone.conf to '
'avoid this message.')) 'avoid this message.'))
self._disable_paging() self._disable_paging()
@ -1181,7 +1182,7 @@ class BaseLdap(object):
try: try:
ldap_attr, attr_map = item.split(':') ldap_attr, attr_map = item.split(':')
except Exception: except Exception:
LOG.warn(_( LOG.warn(_LW(
'Invalid additional attribute mapping: "%s". ' 'Invalid additional attribute mapping: "%s". '
'Format must be <ldap_attribute>:<keystone_attribute>'), 'Format must be <ldap_attribute>:<keystone_attribute>'),
item) item)

View File

@ -31,6 +31,8 @@ from keystone.common import dependency
from keystone.common import utils from keystone.common import utils
from keystone import exception from keystone import exception
from keystone.i18n import _ from keystone.i18n import _
from keystone.i18n import _LI
from keystone.i18n import _LW
from keystone.models import token_model from keystone.models import token_model
from keystone.openstack.common import importutils from keystone.openstack.common import importutils
from keystone.openstack.common import jsonutils from keystone.openstack.common import jsonutils
@ -71,32 +73,33 @@ def validate_token_bind(context, token_ref):
# no bind provided and none required # no bind provided and none required
return return
else: else:
LOG.info(_("No bind information present in token")) LOG.info(_LI("No bind information present in token"))
raise exception.Unauthorized() raise exception.Unauthorized()
if name and name not in bind: 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() raise exception.Unauthorized()
for bind_type, identifier in six.iteritems(bind): for bind_type, identifier in six.iteritems(bind):
if bind_type == 'kerberos': if bind_type == 'kerberos':
if not (context['environment'].get('AUTH_TYPE', '').lower() if not (context['environment'].get('AUTH_TYPE', '').lower()
== 'negotiate'): == 'negotiate'):
LOG.info(_("Kerberos credentials required and not present")) LOG.info(_LI("Kerberos credentials required and not present"))
raise exception.Unauthorized() raise exception.Unauthorized()
if not context['environment'].get('REMOTE_USER') == identifier: 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() raise exception.Unauthorized()
LOG.info(_("Kerberos bind authentication successful")) LOG.info(_LI("Kerberos bind authentication successful"))
elif bind_mode == 'permissive': elif bind_mode == 'permissive':
LOG.debug(("Ignoring unknown bind for permissive mode: " LOG.debug(("Ignoring unknown bind for permissive mode: "
"{%(bind_type)s: %(identifier)s}"), "{%(bind_type)s: %(identifier)s}"),
{'bind_type': bind_type, 'identifier': identifier}) {'bind_type': bind_type, 'identifier': identifier})
else: else:
LOG.info(_("Couldn't verify unknown bind: " LOG.info(_LI("Couldn't verify unknown bind: "
"{%(bind_type)s: %(identifier)s}"), "{%(bind_type)s: %(identifier)s}"),
{'bind_type': bind_type, 'identifier': identifier}) {'bind_type': bind_type, 'identifier': identifier})
raise exception.Unauthorized() raise exception.Unauthorized()
@ -220,7 +223,8 @@ class Application(BaseApplication):
result = method(context, **params) result = method(context, **params)
except exception.Unauthorized as e: except exception.Unauthorized as e:
LOG.warning( 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']}) {'exception': e, 'remote_addr': req.environ['REMOTE_ADDR']})
return render_exception(e, context=context, return render_exception(e, context=context,
user_locale=best_match_language(req)) user_locale=best_match_language(req))
@ -339,7 +343,7 @@ class Application(BaseApplication):
token_data = self.token_provider_api.validate_token( token_data = self.token_provider_api.validate_token(
context['token_id']) context['token_id'])
except exception.TokenNotFound: 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() raise exception.Unauthorized()
token_ref = token_model.KeystoneToken(token_id=context['token_id'], token_ref = token_model.KeystoneToken(token_id=context['token_id'],