From a08bcca93405e1497bf849db20adc42f020d6d0b Mon Sep 17 00:00:00 2001 From: Emyll Almonte Date: Fri, 7 Jan 2022 14:13:04 -0500 Subject: [PATCH] Update local_mods in git.py to show destination of conflict (#72405) Git module, specify that the local modification is in the destination directory so that some of the users clearly understand this.. --- ...-module-local_mods-show-conflict-destination-directory.yml | 2 ++ lib/ansible/modules/git.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/72405-git-module-local_mods-show-conflict-destination-directory.yml diff --git a/changelogs/fragments/72405-git-module-local_mods-show-conflict-destination-directory.yml b/changelogs/fragments/72405-git-module-local_mods-show-conflict-destination-directory.yml new file mode 100644 index 00000000000..62926405f2a --- /dev/null +++ b/changelogs/fragments/72405-git-module-local_mods-show-conflict-destination-directory.yml @@ -0,0 +1,2 @@ +minor_changes: + - git - display the destination directory path in error msg when local_mods detects local modifications conflict so that users see the exact location diff --git a/lib/ansible/modules/git.py b/lib/ansible/modules/git.py index 85c8869ae90..30ad143b8a1 100644 --- a/lib/ansible/modules/git.py +++ b/lib/ansible/modules/git.py @@ -1304,11 +1304,11 @@ def main(): if local_mods: # failure should happen regardless of check mode if not force: - module.fail_json(msg="Local modifications exist in repository (force=no).", **result) + module.fail_json(msg="Local modifications exist in the destination: " + dest + " (force=no).", **result) # if force and in non-check mode, do a reset if not module.check_mode: reset(git_path, module, dest) - result.update(changed=True, msg='Local modifications exist.') + result.update(changed=True, msg='Local modifications exist in the destination: ' + dest) # exit if already at desired sha version if module.check_mode: