Get gerrit version just once
diff --git a/jeepyb/cmd/manage_projects.py b/jeepyb/cmd/manage_projects.py
index 9aef64b..194c627 100644
--- a/jeepyb/cmd/manage_projects.py
+++ b/jeepyb/cmd/manage_projects.py
@@ -87,6 +87,7 @@
}
_gerrit_groups = None
+_gerrit_version = None
class FetchConfigException(Exception):
@@ -242,9 +243,11 @@
def get_group_uuid(gerrit, group, run_local=True):
- version = ''.join(gerrit.getVersion().split('.')[:2])
+ global _gerrit_version
+ if _gerrit_version is None:
+ _gerrit_version = ''.join(gerrit.getVersion().split('.')[:2])
- uuid = _get_group_uuid(group, gerrit, version, run_local, retries=1)
+ uuid = _get_group_uuid(group, gerrit, _gerrit_version, run_local, retries=1)
if uuid:
return uuid
if group in GERRIT_SYSTEM_GROUPS:
@@ -255,7 +258,7 @@
# Gerrit now adds creating user to groups. We don't want that.
gerrit.removeMember(group, gerrit.username)
break
- uuid = _get_group_uuid(group, gerrit, version, run_local)
+ uuid = _get_group_uuid(group, gerrit, _gerrit_version, run_local)
if uuid:
return uuid
return None