Catch OSError during cache directories creation, fixes #19249

This commit is contained in:
Vasili Akulich 2015-08-21 16:01:13 +03:00 committed by rallytime
parent 1ac8287588
commit ec2b2c3e40

View File

@ -230,7 +230,10 @@ def file_hash(load, fnd):
cache_dir = os.path.dirname(cache_path)
# make cache directory if it doesn't exist
if not os.path.exists(cache_dir):
os.makedirs(cache_dir)
try:
os.makedirs(cache_dir)
except OSError:
pass
# save the cache object "hash:mtime"
cache_object = '{0}:{1}'.format(ret['hsum'], os.path.getmtime(path))
with salt.utils.flopen(cache_path, 'w') as fp_: