From 02bc8fe6350a6e9c55206aa68ae47adf400d290b Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Wed, 14 Nov 2012 15:52:02 -0800 Subject: [PATCH] Print git output when git push fails. In the manage_projects.py script print the captured git output when git push fails. Change-Id: I77d8b7e926b6b23b4727a1856a79146daa9d6381 Reviewed-on: https://review.openstack.org/16137 Reviewed-by: Monty Taylor Approved: Clark Boylan Reviewed-by: Clark Boylan Tested-by: Jenkins --- modules/gerrit/files/scripts/manage_projects.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/gerrit/files/scripts/manage_projects.py b/modules/gerrit/files/scripts/manage_projects.py index cf88fb3e3e..4ef8a70fef 100755 --- a/modules/gerrit/files/scripts/manage_projects.py +++ b/modules/gerrit/files/scripts/manage_projects.py @@ -81,6 +81,13 @@ def git_command(repo_dir, sub_cmd, env={}): return status +def git_command_output(repo_dir, sub_cmd, env={}): + git_dir = os.path.join(repo_dir, '.git') + cmd = "git --git-dir=%s --work-tree=%s %s" % (git_dir, repo_dir, sub_cmd) + status, out = run_command(cmd, True, env) + return (status, out) + + def fetch_config(project, remote_url, repo_path, env={}): status = git_command(repo_path, "fetch %s +refs/meta/config:" "refs/remotes/gerrit-meta/config" % remote_url, env) @@ -119,11 +126,12 @@ def push_acl_config(project, remote_url, repo_path, env={}): if status != 0: print "Failed to commit config for project: %s" % project return False - status = git_command(repo_path, + status, out = git_command_output(repo_path, "push %s HEAD:refs/meta/config" % remote_url, env) if status != 0: print "Failed to push config for project: %s" % project + print out return False return True