[ANSIBLE] Drop Helm v2 specific code from application role
[oom/offline-installer.git] / build / download / docker_downloader.py
index d83f682..847bc18 100755 (executable)
@@ -40,7 +40,7 @@ class DockerDownloader(ConcurrentDownloader):
         self._save = save
         try:
             # big timeout in case of massive images like pnda-mirror-container:5.0.0 (11.4GB)
-            self._docker_client = docker.client.DockerClient(version='auto', timeout=300)
+            self._docker_client = docker.from_env(timeout=300)
         except docker.errors.DockerException as err:
             log.exception(
                 'Error creating docker client. Check if is docker installed and running'
@@ -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)):