From 6df0b27ee4fd9d6b23c503427c18f20441bd7c73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Antal?= Date: Tue, 7 Feb 2017 14:22:32 +0100 Subject: [PATCH] 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 --- neutronclient/osc/v2/fwaas/firewallgroup.py | 4 ++-- neutronclient/osc/v2/fwaas/firewallpolicy.py | 4 ++-- neutronclient/osc/v2/fwaas/firewallrule.py | 4 ++-- neutronclient/osc/v2/trunk/network_trunk.py | 4 ++-- tox.ini | 2 ++ 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/neutronclient/osc/v2/fwaas/firewallgroup.py b/neutronclient/osc/v2/fwaas/firewallgroup.py index b5b388879..4eceddf0c 100644 --- a/neutronclient/osc/v2/fwaas/firewallgroup.py +++ b/neutronclient/osc/v2/fwaas/firewallgroup.py @@ -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) diff --git a/neutronclient/osc/v2/fwaas/firewallpolicy.py b/neutronclient/osc/v2/fwaas/firewallpolicy.py index 5ac097145..6fad694b8 100644 --- a/neutronclient/osc/v2/fwaas/firewallpolicy.py +++ b/neutronclient/osc/v2/fwaas/firewallpolicy.py @@ -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) diff --git a/neutronclient/osc/v2/fwaas/firewallrule.py b/neutronclient/osc/v2/fwaas/firewallrule.py index ec8735165..e91786771 100644 --- a/neutronclient/osc/v2/fwaas/firewallrule.py +++ b/neutronclient/osc/v2/fwaas/firewallrule.py @@ -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) diff --git a/neutronclient/osc/v2/trunk/network_trunk.py b/neutronclient/osc/v2/trunk/network_trunk.py index acd6208db..0cee32e5d 100644 --- a/neutronclient/osc/v2/trunk/network_trunk.py +++ b/neutronclient/osc/v2/trunk/network_trunk.py @@ -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 " diff --git a/tox.ini b/tox.ini index f9364c38b..aeb09c7a5 100644 --- a/tox.ini +++ b/tox.ini @@ -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