Handle log message interpolation by the logger in compute/

According to OpenStack Guideline[1], logged string message should be
interpolated by the logger.

[1]: http://docs.openstack.org/developer/oslo.i18n/guidelines.html#adding-variables-to-log-messages

Change-Id: Ib7b5fb5f794026fc8a84260c4803afea321a9cf5
Closes-Bug: #1596829
This commit is contained in:
Gábor Antal 2017-02-13 18:41:24 +01:00
parent 0c42c88d88
commit 1c91e9828d
4 changed files with 7 additions and 10 deletions

View File

@ -128,8 +128,8 @@ class DeleteAggregate(command.Command):
except Exception as e:
result += 1
LOG.error(_("Failed to delete aggregate with name or "
"ID '%(aggregate)s': %(e)s")
% {'aggregate': a, 'e': e})
"ID '%(aggregate)s': %(e)s"),
{'aggregate': a, 'e': e})
if result > 0:
total = len(parsed_args.aggregate)

View File

@ -171,7 +171,7 @@ class CreateFlavor(command.ShowOne):
except Exception as e:
msg = _("Failed to add project %(project)s access to "
"flavor: %(e)s")
LOG.error(msg % {'project': parsed_args.project, 'e': e})
LOG.error(msg, {'project': parsed_args.project, 'e': e})
if parsed_args.property:
try:
flavor.set_keys(parsed_args.property)
@ -208,8 +208,7 @@ class DeleteFlavor(command.Command):
except Exception as e:
result += 1
LOG.error(_("Failed to delete flavor with name or "
"ID '%(flavor)s': %(e)s")
% {'flavor': f, 'e': e})
"ID '%(flavor)s': %(e)s"), {'flavor': f, 'e': e})
if result > 0:
total = len(parsed_args.flavor)
@ -395,7 +394,7 @@ class ShowFlavor(command.ShowOne):
except Exception as e:
msg = _("Failed to get access projects list "
"for flavor '%(flavor)s': %(e)s")
LOG.error(msg % {'flavor': parsed_args.flavor, 'e': e})
LOG.error(msg, {'flavor': parsed_args.flavor, 'e': e})
flavor = resource_flavor._info.copy()
flavor.update({

View File

@ -106,8 +106,7 @@ class DeleteKeypair(command.Command):
except Exception as e:
result += 1
LOG.error(_("Failed to delete key with name "
"'%(name)s': %(e)s")
% {'name': n, 'e': e})
"'%(name)s': %(e)s"), {'name': n, 'e': e})
if result > 0:
total = len(parsed_args.name)

View File

@ -50,8 +50,7 @@ class DeleteService(command.Command):
except Exception as e:
result += 1
LOG.error(_("Failed to delete compute service with "
"ID '%(service)s': %(e)s")
% {'service': s, 'e': e})
"ID '%(service)s': %(e)s"), {'service': s, 'e': e})
if result > 0:
total = len(parsed_args.service)