Add error message from git to message returned from ansible

Fixes #81
reviewable/pr18780/r1
Toshio Kuratomi 10 years ago
parent b0c94cd6f6
commit 7350d2cc7f

@ -443,19 +443,21 @@ def fetch(git_path, module, repo, dest, version, remote, bare):
(rc, out1, err1) = module.run_command([git_path, 'fetch', remote, '+refs/heads/*:refs/heads/*'], cwd=dest) (rc, out1, err1) = module.run_command([git_path, 'fetch', remote, '+refs/heads/*:refs/heads/*'], cwd=dest)
else: else:
(rc, out1, err1) = module.run_command("%s fetch %s" % (git_path, remote), cwd=dest) (rc, out1, err1) = module.run_command("%s fetch %s" % (git_path, remote), cwd=dest)
if rc != 0:
module.fail_json(msg="Failed to download remote objects and refs")
out_acc.append(out1) out_acc.append(out1)
err_acc.append(err1) err_acc.append(err1)
if rc != 0:
module.fail_json(msg="Failed to download remote objects and refs: %s %s" %
(''.join(out_acc), ''.join(err_acc)))
if bare: if bare:
(rc, out2, err2) = module.run_command([git_path, 'fetch', remote, '+refs/tags/*:refs/tags/*'], cwd=dest) (rc, out2, err2) = module.run_command([git_path, 'fetch', remote, '+refs/tags/*:refs/tags/*'], cwd=dest)
else: else:
(rc, out2, err2) = module.run_command("%s fetch --tags %s" % (git_path, remote), cwd=dest) (rc, out2, err2) = module.run_command("%s fetch --tags %s" % (git_path, remote), cwd=dest)
if rc != 0:
module.fail_json(msg="Failed to download remote objects and refs")
out_acc.append(out2) out_acc.append(out2)
err_acc.append(err2) err_acc.append(err2)
if rc != 0:
module.fail_json(msg="Failed to download remote objects and refs: %s %s" %
(''.join(out_acc), ''.join(err_acc)))
return (rc, ''.join(out_acc), ''.join(err_acc)) return (rc, ''.join(out_acc), ''.join(err_acc))

Loading…
Cancel
Save