mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Tidy up fix of git module traceback
This commit is contained in:
parent
2d5b942ffe
commit
d9576b3529
1 changed files with 4 additions and 2 deletions
|
@ -271,7 +271,6 @@ def switch_version(git_path, module, dest, remote, version):
|
||||||
cmd = "%s reset --hard %s/%s" % (git_path, remote, version)
|
cmd = "%s reset --hard %s/%s" % (git_path, remote, version)
|
||||||
else:
|
else:
|
||||||
cmd = "%s checkout --force %s" % (git_path, version)
|
cmd = "%s checkout --force %s" % (git_path, version)
|
||||||
branch = version
|
|
||||||
else:
|
else:
|
||||||
branch = get_head_branch(git_path, module, dest, remote)
|
branch = get_head_branch(git_path, module, dest, remote)
|
||||||
(rc, out, err) = module.run_command("%s checkout --force %s" % (git_path, branch))
|
(rc, out, err) = module.run_command("%s checkout --force %s" % (git_path, branch))
|
||||||
|
@ -280,6 +279,9 @@ def switch_version(git_path, module, dest, remote, version):
|
||||||
cmd = "%s reset --hard %s" % (git_path, remote)
|
cmd = "%s reset --hard %s" % (git_path, remote)
|
||||||
(rc, out1, err1) = module.run_command(cmd)
|
(rc, out1, err1) = module.run_command(cmd)
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
|
if version != 'HEAD':
|
||||||
|
module.fail_json(msg="Failed to checkout %s" % (version))
|
||||||
|
else:
|
||||||
module.fail_json(msg="Failed to checkout branch %s" % (branch))
|
module.fail_json(msg="Failed to checkout branch %s" % (branch))
|
||||||
(rc, out2, err2) = submodule_update(git_path, module, dest)
|
(rc, out2, err2) = submodule_update(git_path, module, dest)
|
||||||
return (rc, out1 + out2, err1 + err2)
|
return (rc, out1 + out2, err1 + err2)
|
||||||
|
|
Loading…
Reference in a new issue