From ce25e06d8f111fe3fc9e82f3acd5580a79041b28 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Sun, 29 Mar 2020 20:44:24 +0000 Subject: [PATCH] Catch exceptions when checking for groups Work around gerritlib raising a generic "Exception" exception when listGroup() finds no group. Change-Id: I63de5aac729b29366b37f1304369419328f4a051 --- jeepyb/cmd/manage_projects.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/jeepyb/cmd/manage_projects.py b/jeepyb/cmd/manage_projects.py index fb4aec9..c438f02 100644 --- a/jeepyb/cmd/manage_projects.py +++ b/jeepyb/cmd/manage_projects.py @@ -198,7 +198,12 @@ def _get_group_uuid(gerrit, group, retries=10): Wait for up to 10 seconds for the group to be created in the DB. """ for x in range(retries): - group_list = list(gerrit.listGroup(group, verbose=True)) + # Work around gerritlib raising a generic "Exception" exception + # when listGroup() finds no group + try: + group_list = list(gerrit.listGroup(group, verbose=True)) + except Exception: + group_list = None if group_list: return group_list[0].split('\t')[1] if retries > 1: