From 1f96c061a945b977720c4e0450a090676e0496ce Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: May 02 2019 00:05:23 +0000 Subject: Don't log an exception we're ignoring like we didn't ignore it As the comment says, all we really want to do here is catch an expected exception and ignore it. But using `log.exception` is an odd thing to do in this case. `log.exception` logs in a way that looks *exactly like* the exception was not caught and the command crashed: [adamw@adam blockerbugs (develop)]$ python3 run_cli.py -f sync ... update_sync 2019-05-01 17:02:04 INFO found 7 bugs in f31 release update_sync 2019-05-01 17:02:04 ERROR Invalid releases specified: f31 Traceback (most recent call last): File "/home/adamw/local/blockerbugs/blockerbugs/util/update_sync.py", line 122, in search_updates result = self.bodhi_interface.query(**queries_data) File "/usr/lib/python3.7/site-packages/fedora/client/bodhi.py", line 118, in wrapper raise BodhiClientException(problems) fedora.client.bodhi.BodhiClientException: Invalid releases specified: f31 [adamw@adam blockerbugs (develop)]$ This is highly confusing, and I've now *twice* run into this, thought the sync was crashing, and spent half an hour wondering why the exception wasn't ignored as expected before I realized it *was* ignored as expected but this output was fooling me. So let's not log the exception as if we weren't ignoring it, let's instead log something that looks much less scary and makes it clearer what's going on. Signed-off-by: Adam Williamson --- diff --git a/blockerbugs/util/update_sync.py b/blockerbugs/util/update_sync.py index 37caa7a..e61f2a8 100644 --- a/blockerbugs/util/update_sync.py +++ b/blockerbugs/util/update_sync.py @@ -124,7 +124,9 @@ class UpdateSync(object): # ignore invalid release error so it doesn't blow up when # bug trackers for a release not present in bodhi are added if 'Invalid releases' in str(e): - self.log.exception(e) + self.log.info("Release %d not found by Bodhi (normal if " + "release not branched yet)" % release_num) + self.log.debug(e) return [] else: raise