mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-27 23:21:22 -07:00
avoid failing when mode is none
This commit is contained in:
parent
5622fc23bc
commit
65b82f69e4
1 changed files with 4 additions and 1 deletions
|
@ -41,7 +41,10 @@ def makedirs_safe(path, mode=None):
|
||||||
'''Safe way to create dirs in muliprocess/thread environments'''
|
'''Safe way to create dirs in muliprocess/thread environments'''
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
try:
|
try:
|
||||||
|
if mode:
|
||||||
os.makedirs(path, mode)
|
os.makedirs(path, mode)
|
||||||
|
else:
|
||||||
|
os.makedirs(path)
|
||||||
except OSError, e:
|
except OSError, e:
|
||||||
if e.errno != EEXIST:
|
if e.errno != EEXIST:
|
||||||
raise
|
raise
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue