Skip to content

Commit

Permalink
Pass absolute paths to atmoic_move(). (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein authored Oct 1, 2024
1 parent 4c4d1d8 commit 04dd98b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelogs/fragments/208-atomic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- "sops_encrypt - pass absolute paths to ``module.atomic_move()`` (https://github.com/ansible/ansible/issues/83950, https://github.com/ansible-collections/community.sops/pull/208)."
2 changes: 1 addition & 1 deletion plugins/module_utils/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def write_file(module, content):
if os.path.exists(file_args['path']):
module.set_fs_attributes_if_different(file_args, False)
# Move tempfile to final destination
module.atomic_move(tmp_name, file_args['path'])
module.atomic_move(os.path.abspath(tmp_name), os.path.abspath(file_args['path']))
# Try to update permissions again
module.set_fs_attributes_if_different(file_args, False)
except Exception as e:
Expand Down

0 comments on commit 04dd98b

Please sign in to comment.