1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

avoid failing when mode is none

This commit is contained in:
Brian Coca 2015-06-02 23:39:57 -04:00
parent 5622fc23bc
commit 65b82f69e4

View file

@ -41,7 +41,10 @@ def makedirs_safe(path, mode=None):
'''Safe way to create dirs in muliprocess/thread environments'''
if not os.path.exists(path):
try:
if mode:
os.makedirs(path, mode)
else:
os.makedirs(path)
except OSError, e:
if e.errno != EEXIST:
raise