From fa82aa9c88cca6e526e565da43e9372001063d57 Mon Sep 17 00:00:00 2001 From: Hunor Csomortáni Date: Mar 16 2018 21:58:46 +0000 Subject: Fix logging-not-lazy pylint warnings As I've learnt, this avoids string interpolation in case logs are not printed due to the loglevel set. This can save a few CPU cycles, and make CI pass this step. Signed-off-by: Hunor Csomortáni --- diff --git a/greenwave/consumers/resultsdb.py b/greenwave/consumers/resultsdb.py index 314e416..a3cbf56 100644 --- a/greenwave/consumers/resultsdb.py +++ b/greenwave/consumers/resultsdb.py @@ -111,8 +111,8 @@ class ResultsDBHandler(fedmsg.consumers.FedmsgConsumer): for rule in policy.rules: if rule.test_case_name == testcase: applicable_policies.add(policy) - log.debug("messaging: found %i applicable policies of %i for testcase %r" % ( - len(applicable_policies), len(config['policies']), testcase)) + log.debug("messaging: found %i applicable policies of %i for testcase %r", + len(applicable_policies), len(config['policies']), testcase) # Given all of our applicable policies, build a map of all decision # context we know about, and which product versions they relate to. @@ -120,7 +120,7 @@ class ResultsDBHandler(fedmsg.consumers.FedmsgConsumer): for policy in applicable_policies: versions = set(policy.product_versions) decision_contexts[policy.decision_context].update(versions) - log.debug("messaging: found %i decision contexts" % len(decision_contexts)) + log.debug("messaging: found %i decision contexts", len(decision_contexts)) # For every context X version combination, ask greenwave if this new # result pushes any decisions over a threshold. diff --git a/greenwave/utils.py b/greenwave/utils.py index d480051..c36522e 100644 --- a/greenwave/utils.py +++ b/greenwave/utils.py @@ -76,17 +76,17 @@ def load_config(config_obj=None): else: default_config_file = '/etc/greenwave/settings.py' - log.debug("config: Loading config from %r" % config_obj) + log.debug("config: Loading config from %r", config_obj) config.from_object(config_obj) config_file = os.environ.get('GREENWAVE_CONFIG', default_config_file) - log.debug("config: Extending config with %r" % config_file) + log.debug("config: Extending config with %r", config_file) config.from_pyfile(config_file) if os.environ.get('SECRET_KEY'): config['SECRET_KEY'] = os.environ['SECRET_KEY'] - log.debug("config: Loading policies from %r" % config['POLICIES_DIR']) + log.debug("config: Loading policies from %r", config['POLICIES_DIR']) config['policies'] = load_policies(config['POLICIES_DIR']) return config