summaryrefslogtreecommitdiff
path: root/source_control/git.py
diff options
context:
space:
mode:
authorMichael Scherer <mscherer@users.noreply.github.com>2016-05-20 18:45:53 +0200
committerToshio Kuratomi <a.badger@gmail.com>2016-05-20 09:45:53 -0700
commita64d72d7bc1d1e37afca3159628e933dcf52abf8 (patch)
tree50ca6f01a36df1e0c09c27d326ed4bcaeb648e6f /source_control/git.py
parent75715a1b7343d5537839ee05ac62f2e40751f915 (diff)
downloadansible-modules-core-a64d72d7bc1d1e37afca3159628e933dcf52abf8.tar.gz
Improve error reporting when git binary fail (#3266)
Showing stderr or stdout is a great help to understand when something go south.
Diffstat (limited to 'source_control/git.py')
-rw-r--r--source_control/git.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/source_control/git.py b/source_control/git.py
index 04ef7dda..4830e8ea 100644
--- a/source_control/git.py
+++ b/source_control/git.py
@@ -296,7 +296,7 @@ def get_submodule_versions(git_path, module, dest, version='HEAD'):
cmd = [git_path, 'submodule', 'foreach', git_path, 'rev-parse', version]
(rc, out, err) = module.run_command(cmd, cwd=dest)
if rc != 0:
- module.fail_json(msg='Unable to determine hashes of submodules')
+ module.fail_json(msg='Unable to determine hashes of submodules', stdout=out, stderr=err, rc=rc)
submodules = {}
subm_name = None
for line in out.splitlines():
@@ -400,7 +400,7 @@ def get_remote_head(git_path, module, dest, version, remote, bare):
return version
(rc, out, err) = module.run_command(cmd, check_rc=True, cwd=cwd)
if len(out) < 1:
- module.fail_json(msg="Could not determine remote revision for %s" % version)
+ module.fail_json(msg="Could not determine remote revision for %s" % version, stdout=out, stderr=err, rc=rc)
if tag:
# Find the dereferenced tag if this is an annotated tag.
@@ -427,7 +427,7 @@ def get_branches(git_path, module, dest):
cmd = '%s branch -a' % (git_path,)
(rc, out, err) = module.run_command(cmd, cwd=dest)
if rc != 0:
- module.fail_json(msg="Could not determine branch data - received %s" % out)
+ module.fail_json(msg="Could not determine branch data - received %s" % out, stdout=out, stderr=err)
for line in out.split('\n'):
branches.append(line.strip())
return branches
@@ -437,7 +437,7 @@ def get_tags(git_path, module, dest):
cmd = '%s tag' % (git_path,)
(rc, out, err) = module.run_command(cmd, cwd=dest)
if rc != 0:
- module.fail_json(msg="Could not determine tag data - received %s" % out)
+ module.fail_json(msg="Could not determine tag data - received %s" % out, stdout=out, stderr=err)
for line in out.split('\n'):
tags.append(line.strip())
return tags
@@ -653,7 +653,7 @@ def set_remote_branch(git_path, module, dest, remote, version, depth):
cmd = "%s fetch --depth=%s %s %s" % (git_path, depth, remote, branchref)
(rc, out, err) = module.run_command(cmd, cwd=dest)
if rc != 0:
- module.fail_json(msg="Failed to fetch branch from remote: %s" % version)
+ module.fail_json(msg="Failed to fetch branch from remote: %s" % version, stdout=out, stderr=err, rc=rc)
def switch_version(git_path, module, dest, remote, version, verify_commit):
cmd = ''
@@ -700,7 +700,7 @@ def verify_commit_sign(git_path, module, dest, version):
cmd = "%s verify-commit %s" % (git_path, version)
(rc, out, err) = module.run_command(cmd, cwd=dest)
if rc != 0:
- module.fail_json(msg='Failed to verify GPG signature of commit/tag "%s"' % version)
+ module.fail_json(msg='Failed to verify GPG signature of commit/tag "%s"' % version, stdout=out, stderr=err, rc=rc)
return (rc, out, err)
# ===========================================