Handle log message interpolation by the logger in network/

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
Related-Bug: #1596829

Change-Id: I17467d01420750c004fbbf2a07730fc2badd62b8
This commit is contained in:
Gábor Antal 2017-02-13 18:13:29 +01:00
parent 30fdb488a8
commit c9b1c2ad96
5 changed files with 12 additions and 12 deletions

View File

@ -119,8 +119,8 @@ class DeleteNetworkSegment(command.Command):
except Exception as e: except Exception as e:
result += 1 result += 1
LOG.error(_("Failed to delete network segment with " LOG.error(_("Failed to delete network segment with "
"ID '%(network_segment)s': %(e)s") "ID '%(network_segment)s': %(e)s"),
% {'network_segment': network_segment, 'e': e}) {'network_segment': network_segment, 'e': e})
if result > 0: if result > 0:
total = len(parsed_args.network_segment) total = len(parsed_args.network_segment)

View File

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

View File

@ -315,7 +315,7 @@ class CreateSecurityGroupRule(common.NetworkAndComputeShowOne):
if parsed_args.src_group: if parsed_args.src_group:
LOG.warning( LOG.warning(
_("The %(old)s option is deprecated, " _("The %(old)s option is deprecated, "
"please use %(new)s instead.") % "please use %(new)s instead."),
{'old': '--src-group', 'new': '--remote-group'}, {'old': '--src-group', 'new': '--remote-group'},
) )
elif not (parsed_args.remote_ip is None and elif not (parsed_args.remote_ip is None and
@ -326,7 +326,7 @@ class CreateSecurityGroupRule(common.NetworkAndComputeShowOne):
if parsed_args.src_ip: if parsed_args.src_ip:
LOG.warning( LOG.warning(
_("The %(old)s option is deprecated, " _("The %(old)s option is deprecated, "
"please use %(new)s instead.") % "please use %(new)s instead."),
{'old': '--src-ip', 'new': '--remote-ip'}, {'old': '--src-ip', 'new': '--remote-ip'},
) )
elif attrs['ethertype'] == 'IPv4': elif attrs['ethertype'] == 'IPv4':
@ -370,7 +370,7 @@ class CreateSecurityGroupRule(common.NetworkAndComputeShowOne):
if parsed_args.src_group: if parsed_args.src_group:
LOG.warning( LOG.warning(
_("The %(old)s option is deprecated, " _("The %(old)s option is deprecated, "
"please use %(new)s instead.") % "please use %(new)s instead."),
{'old': '--src-group', 'new': '--remote-group'}, {'old': '--src-group', 'new': '--remote-group'},
) )
if not (parsed_args.remote_ip is None and if not (parsed_args.remote_ip is None and
@ -379,7 +379,7 @@ class CreateSecurityGroupRule(common.NetworkAndComputeShowOne):
if parsed_args.src_ip: if parsed_args.src_ip:
LOG.warning( LOG.warning(
_("The %(old)s option is deprecated, " _("The %(old)s option is deprecated, "
"please use %(new)s instead.") % "please use %(new)s instead."),
{'old': '--src-ip', 'new': '--remote-ip'}, {'old': '--src-ip', 'new': '--remote-ip'},
) )
else: else:

View File

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

View File

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