mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-13 12:21:12 +00:00
Merge pull request #8329 from rdolejsi/devel
file: prevent replace failure when overwriting empty directory with hard or soft link on force=yes
This commit is contained in:
@@ -233,6 +233,8 @@ def main():
|
||||
# try to replace atomically
|
||||
tmppath = '/'.join([os.path.dirname(path), ".%s.%s.tmp" % (os.getpid(),time.time())])
|
||||
try:
|
||||
if prev_state == 'directory' and (state == 'hard' or state == 'link'):
|
||||
os.rmdir(path)
|
||||
if state == 'hard':
|
||||
os.link(src,tmppath)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user