[PR #8925/7c913b23 backport][stable-7] Pass absolute paths to atomic_move() (#8957)

Pass absolute paths to atomic_move() (#8925)

Pass absolute paths to atmoic_move().

(cherry picked from commit 7c913b239a)

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
patchback[bot]
2024-10-02 09:50:35 +03:00
committed by GitHub
parent 45dd6a59f8
commit 88b1d1e0c1
6 changed files with 12 additions and 6 deletions

View File

@@ -450,7 +450,7 @@ def do_ini(module, filename, section=None, option=None, values=None,
module.fail_json(msg="Unable to create temporary file %s", traceback=traceback.format_exc())
try:
module.atomic_move(tmpfile, target_filename)
module.atomic_move(tmpfile, os.path.abspath(target_filename))
except IOError:
module.ansible.fail_json(msg='Unable to move temporary \
file %s to %s, IOError' % (tmpfile, target_filename), traceback=traceback.format_exc())