diff --git a/changelogs/fragments/86937-git-rm-redundant-err-checks.yml b/changelogs/fragments/86937-git-rm-redundant-err-checks.yml new file mode 100644 index 00000000000..44858e40caf --- /dev/null +++ b/changelogs/fragments/86937-git-rm-redundant-err-checks.yml @@ -0,0 +1,2 @@ +bugfixes: + - git - remove redundant error checks after `run_command(check_rc=True)` diff --git a/lib/ansible/modules/git.py b/lib/ansible/modules/git.py index 7d80d92fdc3..2837e1a346c 100644 --- a/lib/ansible/modules/git.py +++ b/lib/ansible/modules/git.py @@ -994,9 +994,6 @@ def submodules_fetch(git_path, module, remote, track_submodules, dest): begin = get_submodule_versions(git_path, module, dest) cmd = [git_path, 'submodule', 'foreach', git_path, 'fetch'] (rc, out, err) = module.run_command(cmd, check_rc=True, cwd=dest) - if rc != 0: - module.fail_json(msg="Failed to fetch submodules: %s" % out + err) - if track_submodules: # Compare each submodule against its configured remote branch after = {} @@ -1017,8 +1014,6 @@ def submodules_fetch(git_path, module, remote, track_submodules, dest): # Compare against the superproject's expectation cmd = [git_path, 'submodule', 'status'] (rc, out, err) = module.run_command(cmd, check_rc=True, cwd=dest) - if rc != 0: - module.fail_json(msg='Failed to retrieve submodule status: %s' % out + err) for line in out.splitlines(): if line[0] != ' ': changed = True