mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-27 07:01:22 -07:00
minor adjustments as per code review
This commit is contained in:
parent
2590df6df1
commit
ba02e5e3bf
1 changed files with 3 additions and 3 deletions
|
@ -20,6 +20,7 @@ __metaclass__ = type
|
||||||
import os
|
import os
|
||||||
import stat
|
import stat
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
from errno import EEXIST
|
||||||
|
|
||||||
__all__ = ['is_executable', 'unfrackpath']
|
__all__ = ['is_executable', 'unfrackpath']
|
||||||
|
|
||||||
|
@ -38,10 +39,9 @@ def unfrackpath(path):
|
||||||
|
|
||||||
def makedirs_safe(path, mode=None):
|
def makedirs_safe(path, mode=None):
|
||||||
'''Safe way to create dirs in muliprocess/thread environments'''
|
'''Safe way to create dirs in muliprocess/thread environments'''
|
||||||
while not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
try:
|
try:
|
||||||
os.makedirs(path, mode)
|
os.makedirs(path, mode)
|
||||||
except OSError, e:
|
except OSError, e:
|
||||||
if e.errno != 17:
|
if e.errno != EEXIST:
|
||||||
raise
|
raise
|
||||||
sleep(1)
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue