git: Remove unnecessary return code checking.

The functions either return rc=0 or call fail_json themselves.
reviewable/pr18780/r1
Yap Sok Ann 11 years ago
parent 201ff02d1f
commit 3ff0c6d50d

@ -337,7 +337,7 @@ def main():
if not os.path.exists(gitconfig):
if module.check_mode:
module.exit_json(changed=True)
(rc, out, err) = clone(git_path, module, repo, dest, remote, depth, version)
clone(git_path, module, repo, dest, remote, depth, version)
elif not update:
# Just return having found a repo already in the dest path
# this does no checking that the repo is the actual repo
@ -351,9 +351,7 @@ def main():
# if force, do a reset
if local_mods and module.check_mode:
module.exit_json(changed=True, msg='Local modifications exist')
(rc, out, err) = reset(git_path, module, dest, force)
if rc != 0:
module.fail_json(msg=err)
reset(git_path, module, dest, force)
# exit if already at desired sha version
if before == version:
module.exit_json(changed=False)
@ -375,15 +373,11 @@ def main():
else:
changed = False
module.exit_json(changed=changed, before=before, after=remote_head)
(rc, out, err) = fetch(git_path, module, repo, dest, version, remote)
if rc != 0:
module.fail_json(msg=err)
fetch(git_path, module, repo, dest, version, remote)
# switch to version specified regardless of whether
# we cloned or pulled
(rc, out, err) = switch_version(git_path, module, dest, remote, version)
if rc != 0:
module.fail_json(msg=err)
switch_version(git_path, module, dest, remote, version)
# determine if we changed anything
after = get_version(git_path, dest)

Loading…
Cancel
Save