Re-read group list on _get_group_uuid
diff --git a/jeepyb/cmd/manage_projects.py b/jeepyb/cmd/manage_projects.py
index 3fe95a2..43aeadc 100644
--- a/jeepyb/cmd/manage_projects.py
+++ b/jeepyb/cmd/manage_projects.py
@@ -219,25 +219,13 @@
time.sleep(1)
else:
global _gerrit_groups
- if _gerrit_groups is None:
- _gerrit_groups = {
- group[0]: group[1]
- for group in csv.reader(gerrit.listGroups(verbose=True),
- delimiter='\t')
- }
- else:
- if group not in _gerrit_groups:
- try:
- # Relying on the outer Exception handler to deal with
- # the StopIteration when listGroup returns nothing
- # (for a system group).
- gdata = next(csv.reader(
- gerrit.listGroup(group, verbose=True),
- delimiter='\t'))
- _gerrit_groups[group] = gdata[1]
- except Exception:
- # group not found will also trigger exception
- pass
+ if _gerrit_groups is not None and group in _gerrit_groups:
+ return _gerrit_groups.get(group, None)
+ _gerrit_groups = {
+ group[0]: group[1]
+ for group in csv.reader(gerrit.listGroups(verbose=True),
+ delimiter='\t')
+ }
return _gerrit_groups.get(group, None)
return None