summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-11-16 15:39:08 +0100
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-11-16 15:39:08 +0100
commit43276843ffb0e3d78178b92af5e2840e9642fd50 (patch)
tree9bdae010146bffe4d91ee36845316f9315ee0567 /build
parentf731e735cfad1b558f42e09a990c1efcf8dc05b5 (diff)
Fix race condition while creating dest dir for docker images
Docker_downloader module uses threads to concurrently save docker images to dest dir which creation is not guarded with any kind of thread lock object thus it could fail on os.makedirs as other thread could have already created that dir. Hence "exist_ok=True" opt is added to os.makedirs call so that it does not fail in such circumstances. Change-Id: I6e2d2c9864b71d038e7b2ed3018cdd3c01916956 Issue-ID: OOM-2631 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
Diffstat (limited to 'build')
-rwxr-xr-xbuild/download/docker_downloader.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/build/download/docker_downloader.py b/build/download/docker_downloader.py
index 27dde12f..847bc180 100755
--- a/build/download/docker_downloader.py
+++ b/build/download/docker_downloader.py
@@ -168,8 +168,7 @@ class DockerDownloader(ConcurrentDownloader):
:param image_name: name of the image from list
"""
dst = '{}/{}'.format(output_dir, self._image_filename(image_name))
- if not os.path.exists(output_dir):
- os.makedirs(output_dir)
+ os.makedirs(output_dir, exist_ok=True)
try:
with open(dst, 'wb') as f:
for chunk in image.save(named=self.image_registry_name(image_name)):