Make Gerrit system user and group configurable
The gerrit2 system user and group was hardcoded in
manage_projects. This simply allows the values to
be overridden by options 'gerrit-system-user' and
'gerrit-system-group' in the defaults section of the
projects.yml file.
fixes lp 1191542
Change-Id: Ieb736e08a6f96c10abfabe8b17808681732cb8b6
Reviewed-on: https://review.openstack.org/33196
Reviewed-by: Monty Taylor <mordred@inaugust.com>
Reviewed-by: James E. Blair <corvus@inaugust.com>
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Approved: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Tested-by: Jenkins
diff --git a/jeepyb/cmd/manage_projects.py b/jeepyb/cmd/manage_projects.py
index 429367c..8da04a9 100644
--- a/jeepyb/cmd/manage_projects.py
+++ b/jeepyb/cmd/manage_projects.py
@@ -299,6 +299,8 @@
GERRIT_USER = defaults.get('gerrit-user')
GERRIT_KEY = defaults.get('gerrit-key')
GERRIT_GITID = defaults.get('gerrit-committer')
+ GERRIT_SYSTEM_USER = defaults.get('gerrit-system-user', 'gerrit2')
+ GERRIT_SYSTEM_GROUP = defaults.get('gerrit-system-group', 'gerrit2')
gerrit = gerritlib.gerrit.Gerrit('localhost',
GERRIT_USER,
@@ -355,8 +357,9 @@
if not os.path.exists(project_dir):
run_command("git --bare init %s" % project_dir)
- run_command("chown -R gerrit2:gerrit2 %s"
- % project_dir)
+ run_command("chown -R %s:%s %s"
+ % (GERRIT_SYSTEM_USER, GERRIT_SYSTEM_GROUP,
+ project_dir))
git_command(repo_path,
push_string % remote_url,