From 15581431c1a30a30f33860e0f895b7973d830e48 Mon Sep 17 00:00:00 2001 From: Angus Lees Date: Mon, 22 Dec 2014 15:40:03 +1100 Subject: [PATCH] embrane: Use lazy logging interpolation 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neutron/plugins/embrane/agent/dispatcher.py b/neutron/plugins/embrane/agent/dispatcher.py index 9af511f7953..2ce7db1b0a7 100644 --- a/neutron/plugins/embrane/agent/dispatcher.py +++ b/neutron/plugins/embrane/agent/dispatcher.py @@ -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