mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
git: Remove unnecessary return code checking.
The functions either return rc=0 or call fail_json themselves.
This commit is contained in:
parent
9af05f4d2f
commit
2ad4d77c9a
1 changed files with 4 additions and 10 deletions
|
@ -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…
Reference in a new issue