mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
created makedirs_safe function for use in cases of multiprocess
should fix #11126 and most race conditions
This commit is contained in:
parent
47be5b4166
commit
2590df6df1
5 changed files with 23 additions and 15 deletions
|
@ -29,6 +29,7 @@ from ansible.errors import *
|
|||
from ansible.plugins.action import ActionBase
|
||||
from ansible.utils.boolean import boolean
|
||||
from ansible.utils.hashing import checksum, checksum_s, md5, secure_hash
|
||||
from ansible.utils.path import makedirs_safe
|
||||
|
||||
class ActionModule(ActionBase):
|
||||
|
||||
|
@ -125,8 +126,7 @@ class ActionModule(ActionBase):
|
|||
|
||||
if remote_checksum != local_checksum:
|
||||
# create the containing directories, if needed
|
||||
if not os.path.isdir(os.path.dirname(dest)):
|
||||
os.makedirs(os.path.dirname(dest))
|
||||
makedirs_safe(os.path.dirname(dest))
|
||||
|
||||
# fetch the file and check for changes
|
||||
if remote_data is None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue