From d52774cbebb6e6eeb05016512305119e08d1c88f Mon Sep 17 00:00:00 2001 From: MarcusStrobl Date: Wed, 3 Apr 2024 15:21:34 +0200 Subject: [PATCH] Add more logging info to processes. That time in a try except block --- processes/podman_processor.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/processes/podman_processor.py b/processes/podman_processor.py index 5ea4cfb..34bff2f 100644 --- a/processes/podman_processor.py +++ b/processes/podman_processor.py @@ -40,18 +40,21 @@ def pull_run_image(client, image_name, container_name, environment=None, mounts= print(f"Running Podman container: {container_name}") logging.info(f"Running Podman container: {container_name}") - container = client.containers.run( - image=image_name, - detach=True, - name=container_name, - environment=environment, - mounts=mounts, - network_mode=network_mode, - # volumes=volumes, - command=command, - remove=False - ) - logging.info(f"Container to use: {container}") + try: + container = client.containers.run( + image=image_name, + detach=True, + name=container_name, + environment=environment, + mounts=mounts, + network_mode=network_mode, + # volumes=volumes, + command=command, + remove=False + ) + logging.info(f"Container to use: {container}") + except Exception as e: + logging.info(f"Cannot run client.container. Error: {e}") # Start the container container.start()