Tidy up fix of git module traceback

pull/3723/head
Petr Svoboda 11 years ago
parent 2d5b942ffe
commit d9576b3529

@ -271,7 +271,6 @@ def switch_version(git_path, module, dest, remote, version):
cmd = "%s reset --hard %s/%s" % (git_path, remote, version)
else:
cmd = "%s checkout --force %s" % (git_path, version)
branch = version
else:
branch = get_head_branch(git_path, module, dest, remote)
(rc, out, err) = module.run_command("%s checkout --force %s" % (git_path, branch))
@ -280,7 +279,10 @@ def switch_version(git_path, module, dest, remote, version):
cmd = "%s reset --hard %s" % (git_path, remote)
(rc, out1, err1) = module.run_command(cmd)
if rc != 0:
module.fail_json(msg="Failed to checkout branch %s" % (branch))
if version != 'HEAD':
module.fail_json(msg="Failed to checkout %s" % (version))
else:
module.fail_json(msg="Failed to checkout branch %s" % (branch))
(rc, out2, err2) = submodule_update(git_path, module, dest)
return (rc, out1 + out2, err1 + err2)

Loading…
Cancel
Save