diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-11-14 06:46:06 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-11-14 06:46:06 +0000 |
commit | 511c3ad577c04dda47235c0d5829406f8d7ad360 (patch) | |
tree | f047c9b1a10f4a1620478de46dd42854fda78cc7 /jenkins_jobs/builder.py | |
parent | e5ee0ce0025900002092b9dc9088801e8b8c2c08 (diff) | |
parent | 641eb75b69eccd9d81280ff987dc3cfae3a7b4e0 (diff) | |
download | python-jenkins-job-builder-511c3ad577c04dda47235c0d5829406f8d7ad360.tar.gz python-jenkins-job-builder-511c3ad577c04dda47235c0d5829406f8d7ad360.tar.xz python-jenkins-job-builder-511c3ad577c04dda47235c0d5829406f8d7ad360.zip |
Merge "builder.py: fix potential race condition"
Diffstat (limited to 'jenkins_jobs/builder.py')
-rw-r--r-- | jenkins_jobs/builder.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/jenkins_jobs/builder.py b/jenkins_jobs/builder.py index 0da3b57a..66ecd491 100644 --- a/jenkins_jobs/builder.py +++ b/jenkins_jobs/builder.py @@ -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): |