Handle log message interpolation by the logger

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: I5146c62cfd7e05270c5bf8ebc3ebab3908f1f1ca
Closes-Bug: #1661262
Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
This commit is contained in:
Gábor Antal 2017-02-07 14:22:32 +01:00 committed by Akihiro Motoki
parent 901a140a1f
commit 6df0b27ee4
5 changed files with 10 additions and 8 deletions

View File

@ -215,8 +215,8 @@ class DeleteFirewallGroup(command.Command):
except Exception as e:
result += 1
LOG.error(_("Failed to delete firewall group with "
"name or ID '%(firewall_group)s': %(e)s") % {
const.FWG: fwg, 'e': e})
"name or ID '%(firewall_group)s': %(e)s"),
{const.FWG: fwg, 'e': e})
if result > 0:
total = len(parsed_args.firewall_group)

View File

@ -169,8 +169,8 @@ class DeleteFirewallPolicy(command.Command):
except Exception as e:
result += 1
LOG.error(_("Failed to delete Firewall policy with "
"name or ID '%(firewall_policy)s': %(e)s") % {
const.FWP: fwp, 'e': e})
"name or ID '%(firewall_policy)s': %(e)s"),
{const.FWP: fwp, 'e': e})
if result > 0:
total = len(parsed_args.firewall_policy)

View File

@ -229,8 +229,8 @@ class DeleteFirewallRule(command.Command):
except Exception as e:
result += 1
LOG.error(_("Failed to delete Firewall rule with "
"name or ID '%(firewall_rule)s': %(e)s") % {
const.FWR: fwr, 'e': e})
"name or ID '%(firewall_rule)s': %(e)s"),
{const.FWR: fwr, 'e': e})
if result > 0:
total = len(parsed_args.firewall_rule)

View File

@ -112,8 +112,8 @@ class DeleteNetworkTrunk(command.Command):
except Exception as e:
result += 1
LOG.error(_("Failed to delete trunk with name "
"or ID '%(trunk)s': %(e)s")
% {'trunk': trunk, 'e': e})
"or ID '%(trunk)s': %(e)s"),
{'trunk': trunk, 'e': e})
if result > 0:
total = len(parsed_args.trunk)
msg = (_("%(result)s of %(total)s trunks failed "

View File

@ -55,3 +55,5 @@ commands = sphinx-build -a -E -d releasenotes/build/doctrees -b html releasenote
[flake8]
show-source = true
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,tools
# H904: Delay string interpolations at logging calls
enable-extensions=H904