Merge "builder.py: fix potential race condition"

This commit is contained in:
Jenkins 2015-11-14 06:46:06 +00:00 committed by Gerrit Code Review
commit 511c3ad577

View File

@ -66,7 +66,14 @@ class CacheStorage(object):
os.path.join(home, '.cache')
path = os.path.join(xdg_cache_home, 'jenkins_jobs')
if not os.path.isdir(path):
os.makedirs(path)
try:
os.makedirs(path)
except OSError as ose:
# it could happen that two jjb instances are running at the
# same time and that the other instance created the directory
# after we made the check, in which case there is no error
if ose.errno != errno.EEXIST:
raise ose
return path
def set(self, job, md5):