Style improvements to logging format strings

Added the following improvements:

* Use the logging API to handle formatting of message args, which
  potentially prevents us from having to do a bunch of redundant string
  formatting for logging statements which occur below the runtime's
  logging level. For example, in many places `LOG.debug('foo %s' % bar)`
  has been replaced with `LOG.debug('foo %s', bar)`.
* Similarly, this change also removes a few redundant repr() and str()
  calls. For example: `LOG.error('foo %r', repr(bar))` ->
  `LOG.error('foo %r', bar)`, and the same for %s/str().
* One logging statement included some unnecessary escaping in the log
  message string (e.g., 'foo is a \'bar\'', which was replaced with
  "foo is a 'bar'").
* Added some missing message translation calls.

Change-Id: I9080aebdf0ce0e719949d009e0ab85bfc6be8646
Closes-Bug: #1234283
This commit is contained in:
Lars Butler 2013-10-29 17:23:45 +01:00
parent 8f76dcccde
commit e3e5122f4e
20 changed files with 64 additions and 65 deletions

View File

@ -222,7 +222,7 @@ class Manager(manager.Manager):
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(_("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,
'name': CONF.member_role_name} 'name': CONF.member_role_name}

View File

@ -104,7 +104,7 @@ class TemplatedCatalog(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(_('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

@ -39,19 +39,19 @@ def format_url(url, data):
except AttributeError: except AttributeError:
return None return None
except KeyError as e: except KeyError as e:
LOG.error(_("Malformed endpoint %(url)s - unknown key %(keyerror)s") % LOG.error(_("Malformed endpoint %(url)s - unknown key %(keyerror)s"),
{"url": url, {"url": url,
"keyerror": str(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 - unknown key %(keyerror)s" LOG.error(_("Malformed endpoint %(url)s - unknown key %(keyerror)s"
"(are you missing brackets ?)") % "(are you missing brackets ?)"),
{"url": url, {"url": url,
"keyerror": str(e)}) "keyerror": 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(_("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

@ -47,31 +47,31 @@ class DebugProxy(proxy.ProxyBackend):
def get(self, key): def get(self, key):
value = self.proxied.get(key) value = self.proxied.get(key)
msg = _('CACHE_GET: Key: "%(key)s" Value: "%(value)s"') LOG.debug(_('CACHE_GET: Key: "%(key)r" Value: "%(value)r"'),
LOG.debug(msg % {'key': repr(key), 'value': repr(value)}) {'key': key, 'value': value})
return value return value
def get_multi(self, keys): def get_multi(self, keys):
values = self.proxied.get_multi(keys) values = self.proxied.get_multi(keys)
msg = _('CACHE_GET_MULTI: "%(keys)s" Values: "%(values)s"') LOG.debug(_('CACHE_GET_MULTI: "%(keys)r" Values: "%(values)r"'),
LOG.debug(msg % {'keys': repr(keys), 'values': repr(values)}) {'keys': keys, 'values': values})
return values return values
def set(self, key, value): def set(self, key, value):
msg = _('CACHE_SET: Key: "%(key)s" Value: "%(value)s"') LOG.debug(_('CACHE_SET: Key: "%(key)r" Value: "%(value)r"'),
LOG.debug(msg % {'key': repr(key), 'value': repr(value)}) {'key': key, 'value': value})
return self.proxied.set(key, value) return self.proxied.set(key, value)
def set_multi(self, keys): def set_multi(self, keys):
LOG.debug(_('CACHE_SET_MULTI: "%s"') % repr(keys)) LOG.debug(_('CACHE_SET_MULTI: "%r"'), keys)
self.proxied.set_multi(keys) self.proxied.set_multi(keys)
def delete(self, key): def delete(self, key):
self.proxied.delete(key) self.proxied.delete(key)
LOG.debug(_('CACHE_DELETE: "%s"') % repr(key)) LOG.debug(_('CACHE_DELETE: "%r"'), key)
def delete_multi(self, keys): def delete_multi(self, keys):
LOG.debug(_('CACHE_DELETE_MULTI: "%s"') % repr(keys)) LOG.debug(_('CACHE_DELETE_MULTI: "%r"'), keys)
self.proxied.delete_multi(keys) self.proxied.delete_multi(keys)
@ -145,7 +145,7 @@ def configure_cache_region(region):
# ProxyBackends work, see the dogpile.cache documents on # ProxyBackends work, see the dogpile.cache documents on
# "changing-backend-behavior" # "changing-backend-behavior"
cls = importutils.import_class(class_path) cls = importutils.import_class(class_path)
LOG.debug(_('Adding cache-proxy \'%s\' to backend.') % class_path) LOG.debug(_("Adding cache-proxy '%s' to backend."), class_path)
region.wrap(cls) region.wrap(cls)
return region return region

View File

@ -39,7 +39,7 @@ def cms_verify(formatted, signing_cert_file_name, ca_file_name):
output, err = process.communicate(formatted) output, err = process.communicate(formatted)
retcode = process.poll() retcode = process.poll()
if retcode: if retcode:
LOG.error(_('Verify error: %s') % err) LOG.error(_('Verify error: %s'), err)
raise environment.subprocess.CalledProcessError(retcode, raise environment.subprocess.CalledProcessError(retcode,
"openssl", output=err) "openssl", output=err)
return output return output
@ -135,7 +135,7 @@ def cms_sign_text(text, signing_cert_file_name, signing_key_file_name):
"ensure you've configured PKI with " "ensure you've configured PKI with "
"'keystone-manage pki_setup'")) "'keystone-manage pki_setup'"))
else: else:
LOG.error(_('Signing error: %s') % err) LOG.error(_('Signing error: %s'), err)
raise environment.subprocess.CalledProcessError(retcode, "openssl") raise environment.subprocess.CalledProcessError(retcode, "openssl")
return output return output

View File

@ -30,7 +30,7 @@ DEFAULT_DOMAIN_ID = CONF.identity.default_domain_id
def _build_policy_check_credentials(self, action, context, kwargs): def _build_policy_check_credentials(self, action, context, kwargs):
LOG.debug(_('RBAC: Authorizing %(action)s(%(kwargs)s)') % { LOG.debug(_('RBAC: Authorizing %(action)s(%(kwargs)s)'), {
'action': action, 'action': action,
'kwargs': ', '.join(['%s=%s' % (k, kwargs[k]) for k in kwargs])}) 'kwargs': ', '.join(['%s=%s' % (k, kwargs[k]) for k in kwargs])})
@ -184,7 +184,7 @@ def filterprotected(*filters):
if item in context['query_string']: if item in context['query_string']:
target[item] = context['query_string'][item] target[item] = context['query_string'][item]
LOG.debug(_('RBAC: Adding query filter params (%s)') % ( LOG.debug(_('RBAC: Adding query filter params (%s)'), (
', '.join(['%s=%s' % (item, target[item]) ', '.join(['%s=%s' % (item, target[item])
for item in target]))) for item in target])))
@ -262,11 +262,10 @@ class V2Controller(wsgi.Application):
target = _('Domain (%s)') % assignment['domain_id'] target = _('Domain (%s)') % assignment['domain_id']
else: else:
target = _('Unknown Target') target = _('Unknown Target')
msg = (_('Group (%(group)s), referenced in assignment ' msg = _('Group (%(group)s), referenced in assignment '
'for %(target)s, not found - ignoring.') % { 'for %(target)s, not found - ignoring.')
'group': assignment['group_id'], LOG.debug(msg, {'group': assignment['group_id'],
'target': target}) 'target': target})
LOG.debug(msg)
continue continue
if 'project_id' in assignment: if 'project_id' in assignment:

View File

@ -47,7 +47,7 @@ class Server(object):
def start(self, key=None, backlog=128): def start(self, key=None, backlog=128):
"""Run a WSGI server with the given application.""" """Run a WSGI server with the given application."""
LOG.info(_('Starting %(arg0)s on %(host)s:%(port)s') % LOG.info(_('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

@ -212,12 +212,12 @@ class BaseLdap(object):
except Exception: except Exception:
LOG.warn(_( LOG.warn(_(
'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)
continue continue
if attr_map not in self.attribute_mapping: if attr_map not in self.attribute_mapping:
LOG.warn(_('Invalid additional attribute mapping: "%(item)s". ' LOG.warn(_('Invalid additional attribute mapping: "%(item)s". '
'Value "%(attr_map)s" must use one of %(keys)s.') % 'Value "%(attr_map)s" must use one of %(keys)s.'),
{'item': item, 'attr_map': attr_map, {'item': item, 'attr_map': attr_map,
'keys': ', '.join(self.attribute_mapping.keys())}) 'keys': ', '.join(self.attribute_mapping.keys())})
continue continue
@ -486,7 +486,7 @@ class LdapWrapper(object):
'tls_cacertfile=%(tls_cacertfile)s\n' 'tls_cacertfile=%(tls_cacertfile)s\n'
'tls_cacertdir=%(tls_cacertdir)s\n' 'tls_cacertdir=%(tls_cacertdir)s\n'
'tls_req_cert=%(tls_req_cert)s\n' 'tls_req_cert=%(tls_req_cert)s\n'
'tls_avail=%(tls_avail)s\n') % 'tls_avail=%(tls_avail)s\n'),
{'use_tls': use_tls, {'use_tls': use_tls,
'tls_cacertfile': tls_cacertfile, 'tls_cacertfile': tls_cacertfile,
'tls_cacertdir': tls_cacertdir, 'tls_cacertdir': tls_cacertdir,
@ -562,7 +562,7 @@ class LdapWrapper(object):
if kind != 'userPassword' if kind != 'userPassword'
else ['****']) else ['****'])
for kind, values in ldap_attrs] for kind, values in ldap_attrs]
LOG.debug(_('LDAP add: dn=%(dn)s, attrs=%(attrs)s') % { LOG.debug(_('LDAP add: dn=%(dn)s, attrs=%(attrs)s'), {
'dn': dn, 'attrs': sane_attrs}) 'dn': dn, 'attrs': sane_attrs})
return self.conn.add_s(dn, ldap_attrs) return self.conn.add_s(dn, ldap_attrs)
@ -575,7 +575,7 @@ class LdapWrapper(object):
attrlist = [attr for attr in attrlist if attr is not None] attrlist = [attr for attr in attrlist if attr is not None]
LOG.debug(_( LOG.debug(_(
'LDAP search: dn=%(dn)s, scope=%(scope)s, query=%(query)s, ' 'LDAP search: dn=%(dn)s, scope=%(scope)s, query=%(query)s, '
'attrs=%(attrlist)s') % { 'attrs=%(attrlist)s'), {
'dn': dn, 'dn': dn,
'scope': scope, 'scope': scope,
'query': query, 'query': query,
@ -642,7 +642,7 @@ class LdapWrapper(object):
sane_modlist = [(op, kind, (values if kind != 'userPassword' sane_modlist = [(op, kind, (values if kind != 'userPassword'
else ['****'])) else ['****']))
for op, kind, values in ldap_modlist] for op, kind, values in ldap_modlist]
LOG.debug(_('LDAP modify: dn=%(dn)s, modlist=%(modlist)s') % { LOG.debug(_('LDAP modify: dn=%(dn)s, modlist=%(modlist)s'), {
'dn': dn, 'modlist': sane_modlist}) 'dn': dn, 'modlist': sane_modlist})
return self.conn.modify_s(dn, ldap_modlist) return self.conn.modify_s(dn, ldap_modlist)
@ -653,7 +653,7 @@ class LdapWrapper(object):
def delete_ext_s(self, dn, serverctrls): def delete_ext_s(self, dn, serverctrls):
LOG.debug( LOG.debug(
_('LDAP delete_ext: dn=%(dn)s, serverctrls=%(serverctrls)s') % { _('LDAP delete_ext: dn=%(dn)s, serverctrls=%(serverctrls)s'), {
'dn': dn, 'serverctrls': serverctrls}) 'dn': dn, 'serverctrls': serverctrls})
return self.conn.delete_ext_s(dn, serverctrls) return self.conn.delete_ext_s(dn, serverctrls)

View File

@ -73,7 +73,7 @@ def trunc_password(password):
try: try:
if len(password) > max_length: if len(password) > max_length:
LOG.warning( LOG.warning(
_('Truncating user password to %s characters.') % max_length) _('Truncating user password to %s characters.'), max_length)
return password[:max_length] return password[:max_length]
except TypeError: except TypeError:
raise exception.ValidationError(attribute='string', target='password') raise exception.ValidationError(attribute='string', target='password')

View File

@ -235,7 +235,7 @@ 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') % _('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, user_locale=req.best_match_language()) return render_exception(e, user_locale=req.best_match_language())
except exception.Error as e: except exception.Error as e:

View File

@ -56,5 +56,5 @@ class AccessLogMiddleware(wsgi.Middleware):
data['datetime'] = '%s %s' % (now.strftime(APACHE_TIME_FORMAT), data['datetime'] = '%s %s' % (now.strftime(APACHE_TIME_FORMAT),
now.strftime('%z') or '+0000') now.strftime('%z') or '+0000')
LOG.info(APACHE_LOG_FORMAT % data) LOG.info(APACHE_LOG_FORMAT, data)
return response return response

View File

@ -160,7 +160,7 @@ class Identity(identity.Driver):
except exception.UserNotFound: except exception.UserNotFound:
LOG.debug(_("Group member '%(user_dn)s' not found in" LOG.debug(_("Group member '%(user_dn)s' not found in"
" '%(group_id)s'. The user should be removed" " '%(group_id)s'. The user should be removed"
" from the group. The user will be ignored.") % " from the group. The user will be ignored."),
dict(user_dn=user_dn, group_id=group_id)) dict(user_dn=user_dn, group_id=group_id))
return users return users

View File

@ -60,7 +60,7 @@ class Tenant(controller.V2Controller):
try: try:
token_ref = self.token_api.get_token(context['token_id']) token_ref = self.token_api.get_token(context['token_id'])
except exception.NotFound as e: except exception.NotFound as e:
LOG.warning(_('Authentication failed: %s') % e) LOG.warning(_('Authentication failed: %s'), e)
raise exception.Unauthorized(e) raise exception.Unauthorized(e)
user_ref = token_ref['user'] user_ref = token_ref['user']
@ -1120,7 +1120,7 @@ class RoleAssignmentV3(controller.V3Controller):
target = 'Unknown' target = 'Unknown'
LOG.warning( LOG.warning(
_('Group %(group)s not found for role-assignment - ' _('Group %(group)s not found for role-assignment - '
'%(target)s with Role: %(role)s') % { '%(target)s with Role: %(role)s'), {
'group': ref['group_id'], 'target': target, 'group': ref['group_id'], 'target': target,
'role': ref.get('role_id')}) 'role': ref.get('role_id')})
return members return members

View File

@ -91,9 +91,9 @@ class DomainConfigs(dict):
try: try:
domain_ref = assignment_api.get_domain_by_name(domain_name) domain_ref = assignment_api.get_domain_by_name(domain_name)
except exception.DomainNotFound: except exception.DomainNotFound:
msg = (_('Invalid domain name (%s) found in config file name') LOG.warning(
% domain_name) _('Invalid domain name (%s) found in config file name'),
LOG.warning(msg) domain_name)
if domain_ref: if domain_ref:
# Create a new entry in the domain config dict, which contains # Create a new entry in the domain config dict, which contains
@ -116,8 +116,8 @@ class DomainConfigs(dict):
conf_dir = CONF.identity.domain_config_dir conf_dir = CONF.identity.domain_config_dir
if not os.path.exists(conf_dir): if not os.path.exists(conf_dir):
msg = _('Unable to locate domain config directory: %s') % conf_dir LOG.warning(_('Unable to locate domain config directory: %s'),
LOG.warning(msg) conf_dir)
return return
for r, d, f in os.walk(conf_dir): for r, d, f in os.walk(conf_dir):
@ -129,9 +129,9 @@ class DomainConfigs(dict):
[os.path.join(r, fname)], [os.path.join(r, fname)],
names[1]) names[1])
else: else:
msg = (_('Ignoring file (%s) while scanning domain ' LOG.debug(_('Ignoring file (%s) while scanning domain '
'config directory') % fname) 'config directory'),
LOG.debug(msg) fname)
def get_domain_driver(self, domain_id): def get_domain_driver(self, domain_id):
if domain_id in self: if domain_id in self:

View File

@ -93,6 +93,6 @@ def _send_notification(operation, resource_type, resource_id, host=None):
notifier_api.notify( notifier_api.notify(
context, publisher_id, event_type, notifier_api.INFO, payload) context, publisher_id, event_type, notifier_api.INFO, payload)
except Exception: except Exception:
msg = (_('Failed to send %(res_id)s %(event_type)s notification') % LOG.exception(
{'res_id': resource_id, 'event_type': event_type}) _('Failed to send %(res_id)s %(event_type)s notification'),
LOG.exception(msg) {'res_id': resource_id, 'event_type': event_type})

View File

@ -97,7 +97,7 @@ def enforce(credentials, action, target, do_raise=True):
class Policy(policy.Driver): class Policy(policy.Driver):
def enforce(self, credentials, action, target): def enforce(self, credentials, action, target):
LOG.debug(_('enforce %(action)s: %(credentials)s') % { LOG.debug(_('enforce %(action)s: %(credentials)s'), {
'action': action, 'action': action,
'credentials': credentials}) 'credentials': credentials})
enforce(credentials, action, target) enforce(credentials, action, target)

View File

@ -190,7 +190,7 @@ class FakeLdap(object):
if not utils.ldap_check_password(password, db_password): if not utils.ldap_check_password(password, db_password):
LOG.debug(_('FakeLdap bind fail: password for dn=%s does' LOG.debug(_('FakeLdap bind fail: password for dn=%s does'
' not match') % dn) ' not match'), dn)
raise ldap.INVALID_CREDENTIALS raise ldap.INVALID_CREDENTIALS
def unbind_s(self): def unbind_s(self):
@ -209,7 +209,7 @@ class FakeLdap(object):
raise TypeError('must be string, not None. attrs=%s' % attrs) raise TypeError('must be string, not None. attrs=%s' % attrs)
key = '%s%s' % (self.__prefix, dn) key = '%s%s' % (self.__prefix, dn)
LOG.debug(_('FakeLdap add item: dn=%(dn)s, attrs=%(attrs)s') % { LOG.debug(_('FakeLdap add item: dn=%(dn)s, attrs=%(attrs)s'), {
'dn': dn, 'attrs': attrs}) 'dn': dn, 'attrs': attrs})
if key in self.db: if key in self.db:
LOG.debug(_('FakeLdap add item failed: dn=%s is' LOG.debug(_('FakeLdap add item failed: dn=%s is'
@ -259,7 +259,7 @@ class FakeLdap(object):
raise ldap.SERVER_DOWN raise ldap.SERVER_DOWN
key = '%s%s' % (self.__prefix, dn) key = '%s%s' % (self.__prefix, dn)
LOG.debug(_('FakeLdap modify item: dn=%(dn)s attrs=%(attrs)s') % { LOG.debug(_('FakeLdap modify item: dn=%(dn)s attrs=%(attrs)s'), {
'dn': dn, 'attrs': attrs}) 'dn': dn, 'attrs': attrs})
try: try:
entry = self.db[key] entry = self.db[key]
@ -291,7 +291,7 @@ class FakeLdap(object):
except ValueError: except ValueError:
LOG.debug(_('FakeLdap modify item failed: ' LOG.debug(_('FakeLdap modify item failed: '
'item has no attribute "%(k)s" with ' 'item has no attribute "%(k)s" with '
'value "%(v)s" to delete') % { 'value "%(v)s" to delete'), {
'k': k, 'v': val}) 'k': k, 'v': val})
raise ldap.NO_SUCH_ATTRIBUTE raise ldap.NO_SUCH_ATTRIBUTE
else: else:
@ -316,7 +316,7 @@ class FakeLdap(object):
raise ldap.SERVER_DOWN raise ldap.SERVER_DOWN
LOG.debug( LOG.debug(
_('FakeLdap search at dn=%(dn)s scope=%(scope)s query=%(query)s') % _('FakeLdap search at dn=%(dn)s scope=%(scope)s query=%(query)s'),
{'dn': dn, 'scope': SCOPE_NAMES.get(scope, scope), 'query': query}) {'dn': dn, 'scope': SCOPE_NAMES.get(scope, scope), 'query': query})
if scope == ldap.SCOPE_BASE: if scope == ldap.SCOPE_BASE:
try: try:

View File

@ -65,7 +65,7 @@ def validate_auth_info(self, user_ref, tenant_ref):
""" """
# If the user is disabled don't allow them to authenticate # If the user is disabled don't allow them to authenticate
if not user_ref.get('enabled', True): if not user_ref.get('enabled', True):
msg = 'User is disabled: %s' % user_ref['id'] msg = _('User is disabled: %s') % user_ref['id']
LOG.warning(msg) LOG.warning(msg)
raise exception.Unauthorized(msg) raise exception.Unauthorized(msg)
@ -73,14 +73,14 @@ def validate_auth_info(self, user_ref, tenant_ref):
user_domain_ref = self.identity_api.get_domain( user_domain_ref = self.identity_api.get_domain(
user_ref['domain_id']) user_ref['domain_id'])
if user_domain_ref and not user_domain_ref.get('enabled', True): if user_domain_ref and not user_domain_ref.get('enabled', True):
msg = 'Domain is disabled: %s' % user_domain_ref['id'] msg = _('Domain is disabled: %s') % user_domain_ref['id']
LOG.warning(msg) LOG.warning(msg)
raise exception.Unauthorized(msg) raise exception.Unauthorized(msg)
if tenant_ref: if tenant_ref:
# If the project is disabled don't allow them to authenticate # If the project is disabled don't allow them to authenticate
if not tenant_ref.get('enabled', True): if not tenant_ref.get('enabled', True):
msg = 'Tenant is disabled: %s' % tenant_ref['id'] msg = _('Tenant is disabled: %s') % tenant_ref['id']
LOG.warning(msg) LOG.warning(msg)
raise exception.Unauthorized(msg) raise exception.Unauthorized(msg)
@ -89,7 +89,7 @@ def validate_auth_info(self, user_ref, tenant_ref):
tenant_ref['domain_id']) tenant_ref['domain_id'])
if (project_domain_ref and if (project_domain_ref and
not project_domain_ref.get('enabled', True)): not project_domain_ref.get('enabled', True)):
msg = 'Domain is disabled: %s' % project_domain_ref['id'] msg = _('Domain is disabled: %s') % project_domain_ref['id']
LOG.warning(msg) LOG.warning(msg)
raise exception.Unauthorized(msg) raise exception.Unauthorized(msg)

View File

@ -188,7 +188,7 @@ class Manager(manager.Manager):
return None return None
except Exception: except Exception:
LOG.exception(_('Unexpected error or malformed token determining ' LOG.exception(_('Unexpected error or malformed token determining '
'token expiry: %s') % token) 'token expiry: %s'), token)
# FIXME(morganfainberg): This error message needs to be updated to # FIXME(morganfainberg): This error message needs to be updated to
# reflect the token couldn't be found, but this change needs to wait # reflect the token couldn't be found, but this change needs to wait

View File

@ -39,6 +39,6 @@ class Provider(uuid.Provider):
CONF.signing.keyfile) CONF.signing.keyfile)
return token_id return token_id
except environment.subprocess.CalledProcessError: except environment.subprocess.CalledProcessError:
LOG.exception('Unable to sign token') LOG.exception(_('Unable to sign token'))
raise exception.UnexpectedError(_( raise exception.UnexpectedError(_(
'Unable to sign token.')) 'Unable to sign token.'))