Create dirs if not exists

This commit is contained in:
Kunal Ajay Bajpai 2017-10-05 16:28:27 +05:30
parent 1b9cb26f2e
commit b99fd0ad64

View File

@ -3321,6 +3321,15 @@ def _cache_id(minion_id, cache_file):
'''
Helper function, writes minion id to a cache file.
'''
path = os.path.dirname(cache_file)
try:
os.makedirs(path)
except OSError:
if os.path.isdir(path):
pass
else:
raise
try:
with salt.utils.files.fopen(cache_file, 'w') as idf:
idf.write(minion_id)