]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
embrane: Use lazy logging interpolation
authorAngus Lees <gus@inodes.org>
Mon, 22 Dec 2014 04:40:03 +0000 (15:40 +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 embrane via a pylint
test.  Other occurrences are addressed elsewhere.

Change-Id: Iabceb8c7d32111ae97d1200fbd25681e317f7bb7
Partial-Bug: #1404788

neutron/plugins/embrane/agent/dispatcher.py

index 9af511f7953037eb7b54f688dfd6bb8d4bab49b3..2ce7db1b0a76303a0f2e40e4cc69050cca4be1b5 100644 (file)
@@ -108,10 +108,10 @@ class Dispatcher(object):
                         h_exc.BrokenInterface, h_exc.DvaCreationFailed,
                         h_exc.DvaCreationPending, h_exc.BrokenDva,
                         h_exc.ConfigurationFailed) as ex:
-                    LOG.warning(p_con.error_map[type(ex)] % ex.message)
+                    LOG.warning(p_con.error_map[type(ex)], ex.message)
                     transient_state = p_con.Status.ERROR
                 except h_exc.DvaDeleteFailed as ex:
-                    LOG.warning(p_con.error_map[type(ex)] % ex.message)
+                    LOG.warning(p_con.error_map[type(ex)], ex.message)
                     transient_state = p_con.Status.DELETED
                 finally:
                     # if the returned transient state is None, no operations