Pass absolute paths to atmoic_move(). (#799)

This commit is contained in:
Felix Fontein
2024-10-01 21:55:00 +03:00
committed by GitHub
parent 5a2dff7b74
commit db871c2686
4 changed files with 8 additions and 6 deletions

View File

@@ -92,7 +92,7 @@ def write_file(module, content, default_mode=None, path=None):
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
if not module.check_file_absent_if_check_mode(file_args['path']):
module.set_fs_attributes_if_different(file_args, False)