From 9023a46782563dd75283788fd5757e1148004a66 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Mon, 6 May 2013 06:53:10 -0400 Subject: [PATCH] factor out gerrit project creator account this lets you set the gerrit project creator account in yaml, instead of it being hardcoded in the script Change-Id: I08870255fd3f44b8e2ed04ed7a7e80a3dfe2dd39 Reviewed-on: https://review.openstack.org/28286 Reviewed-by: Monty Taylor Reviewed-by: James E. Blair Approved: Jeremy Stanley Reviewed-by: Jeremy Stanley Tested-by: Jenkins --- jeepyb/cmd/manage_projects.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/jeepyb/cmd/manage_projects.py b/jeepyb/cmd/manage_projects.py index 82531f2..429367c 100644 --- a/jeepyb/cmd/manage_projects.py +++ b/jeepyb/cmd/manage_projects.py @@ -21,6 +21,7 @@ # gerrit-host: review.openstack.org # local-git-dir: /var/lib/git # gerrit-key: /home/gerrit2/review_site/etc/ssh_host_rsa_key +# gerrit-committer: Project Creator # has-github: True # has-wiki: False # has-issues: False @@ -153,9 +154,8 @@ def copy_acl_config(project, repo_path, acl_config): return False -def push_acl_config(project, remote_url, repo_path, env={}): - cmd = "commit -a -m'Update project config.' --author='Openstack Project " \ - "Creator '" +def push_acl_config(project, remote_url, repo_path, gitid, env={}): + cmd = "commit -a -m'Update project config.' --author='%s'" % gitid status = git_command(repo_path, cmd) if status != 0: print "Failed to commit config for project: %s" % project @@ -298,6 +298,7 @@ def main(): GERRIT_HOST = defaults.get('gerrit-host') GERRIT_USER = defaults.get('gerrit-user') GERRIT_KEY = defaults.get('gerrit-key') + GERRIT_GITID = defaults.get('gerrit-committer') gerrit = gerritlib.gerrit.Gerrit('localhost', GERRIT_USER, @@ -346,9 +347,8 @@ port=29418 project=%s """ % (GERRIT_HOST, project_git)) git_command(repo_path, "add .gitreview") - cmd = "commit -a -m'Added .gitreview' --author=" \ - "'Openstack Project Creator " \ - "'" + cmd = ("commit -a -m'Added .gitreview' --author='%s'" + % GERRIT_GITID) git_command(repo_path, cmd) push_string = "push --all %s" gerrit.createProject(project) @@ -396,6 +396,7 @@ project=%s push_acl_config(project, remote_url, repo_path, + GERRIT_GITID, ssh_env) finally: run_command("rm -fr %s" % tmpdir)