From 8330e39351a1543d313590dabbd89c3e9b6a2707 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jan 05 2021 10:14:57 +0000 Subject: flag_ci_pr: do not crash if the message does not have a commit_hash It appears that the commit_hash value sent by the CI system is actually coming from pagure's commit_stop which can be null/None. So, let's just check if the message has a commit_hash and if it does not we'll just bail to avoid keeping on crashing. Signed-off-by: Pierre-Yves Chibon --- diff --git a/toddlers/plugins/flag_ci_pr.py b/toddlers/plugins/flag_ci_pr.py index 8e14da0..5bbc8ec 100644 --- a/toddlers/plugins/flag_ci_pr.py +++ b/toddlers/plugins/flag_ci_pr.py @@ -101,6 +101,10 @@ class FlagCIPR(ToddlerBase): ) return + if "commit_hash" not in msg["artifact"] or not msg["artifact"]["commit_hash"]: + _log.info("No commit hash specified, bailing: %s" % msg["artifact"]) + return + pr_id = str(msg["artifact"]["id"]) commit_hash_text = " for %s" % msg["artifact"]["commit_hash"][:8]