mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
make atomic_replace use shutil.copy2 instead of os.rename() so it will
work across filesystems
This commit is contained in:
@@ -797,7 +797,11 @@ class AnsibleModule(object):
|
||||
if self.selinux_enabled():
|
||||
context = self.selinux_default_context(dest)
|
||||
self.set_context_if_different(src, context, False)
|
||||
os.rename(src, dest)
|
||||
try:
|
||||
shutil.copy2(src, dest)
|
||||
except shutil.Error, e:
|
||||
self.fail_json(msg='Could not atomic_replace file: %s to %s: %s' % (src, dest, e))
|
||||
|
||||
|
||||
def run_command(self, args, check_rc=False, close_fds=False, executable=None, data=None):
|
||||
'''
|
||||
|
||||
Reference in New Issue
Block a user