Skip to content

Commit f6fa320

Browse files
bootstrap: bootstrap: Log problems when using docker client
Signed-off-by: Patrick José Pereira <[email protected]>
1 parent 54fe1d6 commit f6fa320

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

bootstrap/bootstrap/bootstrap.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@ def pull(self, component_name: str) -> None:
117117

118118
# if there is no curses support, like in the testing environment, just dump everything
119119
if not curses_ui:
120-
self.client.images.pull(f"{image_name}:{tag}")
120+
try:
121+
self.client.images.pull(f"{image_name}:{tag}")
122+
except Exception as exception:
123+
logger.warning(f"Failed to pull image ({image_name}:{tag}): {exception}")
121124
return
122125

123126
# if there is ncurses support, proceed with it
@@ -154,8 +157,12 @@ def pull(self, component_name: str) -> None:
154157

155158
def image_is_available_locally(self, image_name: str, tag: str) -> bool:
156159
"""Checks if the image is already available locally"""
157-
images = self.client.images.list(image_name)
158-
return any(f"{image_name}:{tag}" in image.tags for image in images)
160+
try:
161+
images = self.client.images.list(image_name)
162+
return any(f"{image_name}:{tag}" in image.tags for image in images)
163+
except Exception as exception:
164+
logger.warning(f"Failed to list image ({image_name}): {exception}")
165+
return false
159166

160167
def start(self, component_name: str) -> bool:
161168
"""Loads settings and starts the containers. Loads default settings if no settings are found
@@ -218,7 +225,11 @@ def is_running(self, component: str) -> bool:
218225
Returns:
219226
bool: True if the chosen container is running
220227
"""
221-
return any(container.name.endswith(component) for container in self.client.containers.list())
228+
try:
229+
return any(container.name.endswith(component) for container in self.client.containers.list())
230+
except Exception as exception:
231+
logger.warning(f"Could not list containers: {exception}")
232+
return False
222233

223234
def is_version_chooser_online(self) -> bool:
224235
"""Check if the version chooser service is online.

0 commit comments

Comments
 (0)