Fix string interpolation at logging call

Skip creating the formatted log message
if the message is not going to be emitted
because of the log level.

Change-Id: I19d985addb2bdc1b5e17ecd5ac90223e5347d7b2
Closes-Bug: #1596829
This commit is contained in:
Takashi NATSUME 2016-07-26 15:48:11 +09:00
parent 3b1c538422
commit ec20f7f85c
3 changed files with 5 additions and 5 deletions

View File

@ -168,7 +168,7 @@ class RetrieveLoadBalancerStatus(neutronV20.NeutronCommand):
return parser
def take_action(self, parsed_args):
self.log.debug('run(%s)' % parsed_args)
self.log.debug('run(%s)', parsed_args)
neutron_client = self.get_client()
lb_id = neutronV20.find_resourceid_by_name_or_id(
neutron_client, self.resource, parsed_args.loadbalancer)

View File

@ -237,9 +237,9 @@ class CreateSubnet(neutronV20.CreateCommand):
self.log.warning(_("An IPv%(ip)d subnet with a %(cidr)s CIDR "
"will have only one usable IP address so "
"the device attached to it will not have "
"any IP connectivity.")
% {"ip": ip_version,
"cidr": unusable_cidr})
"any IP connectivity."),
{"ip": ip_version,
"cidr": unusable_cidr})
updatable_args2body(parsed_args, body, ip_version=ip_version)
if parsed_args.tenant_id:

View File

@ -402,7 +402,7 @@ class CLITestV20SubnetJSON(test_cli20.CLITestV20Base):
position_names = ['ip_version', 'network_id', 'cidr', 'gateway_ip']
position_values = [4, netid, cidr, gateway]
self.mox.StubOutWithMock(cmd.log, 'warning')
cmd.log.warning(mox.IgnoreArg())
cmd.log.warning(mox.IgnoreArg(), {'ip': 4, 'cidr': '/32'})
self._test_create_resource(resource, cmd, name, myid, args,
position_names, position_values)
self.mox.VerifyAll()