]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
brocade: Use lazy logging interpolation
authorAngus Lees <gus@inodes.org>
Mon, 22 Dec 2014 04:41:01 +0000 (15:41 +1100)
committerAngus Lees <gus@inodes.org>
Mon, 22 Dec 2014 06:12:54 +0000 (17:12 +1100)
There are a small number of examples of "eager" interpolation in
neutron:
  logging.debug("foo %s" % arg)

These should be converted to perform the interpolation lazily within
the logging function, since if the severity is below the logging level
then the interpolation can be skipped entirely.

This change addresses all such examples found in brocade
l3_router_plugin via a pylint test.  Other occurrences are addressed
elsewhere.

Change-Id: Ia2d51e8ecbc7af81390577ec69c5ce18523b65f3
Partial-Bug: #1404788

neutron/services/l3_router/brocade/l3_router_plugin.py

index b7c73e770ef9ad4920ec5372dafabff644025656..e3d09658f28b7bba81f7e64c24303a1f450f984e 100644 (file)
@@ -142,10 +142,10 @@ class BrocadeSVIPlugin(router.L3RouterPlugin):
             LOG.debug("Allocated cidr %(cidr)s from the pool, "
                       "network_id %(net_id)s "
                       "bnet %(bnet)s "
-                      "vlan %(vlan_id)d " % ({'cidr': gateway_ip_cidr,
-                                              'net_id': network_id,
-                                              'bnet': bnet,
-                                              'vlan_id': int(vlan_id)}))
+                      "vlan %(vlan_id)d "{'cidr': gateway_ip_cidr,
+                                            'net_id': network_id,
+                                            'bnet': bnet,
+                                            'vlan_id': int(vlan_id)})
             port_filters = {'network_id': [network_id],
                             'device_owner': [DEVICE_OWNER_ROUTER_INTF]}
             port_count = self._core_plugin.get_ports_count(context,
@@ -206,10 +206,11 @@ class BrocadeSVIPlugin(router.L3RouterPlugin):
                 LOG.debug("remove_router_interface removed cidr %(cidr)s"
                           " from the pool,"
                           " network_id %(net_id)s bnet %(bnet)s"
-                          " vlan %(vlan_id)d" %
-                          ({'cidr': gateway_ip_cidr,
-                            'net_id': network_id,
-                            'bnet': bnet, 'vlan_id': int(vlan_id)}))
+                          " vlan %(vlan_id)d",
+                          {'cidr': gateway_ip_cidr,
+                           'net_id': network_id,
+                           'bnet': bnet,
+                           'vlan_id': int(vlan_id)})
                 switch = self._switch
                 self._driver.delete_svi(switch['address'],
                                         switch['username'],