Catch exceptions when checking for groups

Work around gerritlib raising a generic "Exception" exception when
listGroup() finds no group.

Change-Id: I63de5aac729b29366b37f1304369419328f4a051
This commit is contained in:
Jeremy Stanley 2020-03-29 20:44:24 +00:00
parent ca1945dc63
commit ce25e06d8f
1 changed files with 6 additions and 1 deletions

View File

@ -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: