From 44885b7e0c7db3c93c744841bb72adee6053a270 Mon Sep 17 00:00:00 2001 From: Robin Syl Date: Sat, 23 Sep 2023 12:04:17 +0200 Subject: [PATCH] Use new Podman flags for healthcheck Signed-off-by: Robin Syl --- podman_compose.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/podman_compose.py b/podman_compose.py index 52434ff..bba7fe9 100755 --- a/podman_compose.py +++ b/podman_compose.py @@ -1020,10 +1020,9 @@ async def container_to_args(compose, cnt, detached=True): # If it's a string, it's equivalent to specifying CMD-SHELL if is_str(healthcheck_test): # podman does not add shell to handle command with whitespace - podman_args.extend([ - "--healthcheck-command", - "/bin/sh -c " + cmd_quote(healthcheck_test), - ]) + podman_args.extend( + ["--health-cmd", "/bin/sh -c " + cmd_quote(healthcheck_test)] + ) elif is_list(healthcheck_test): healthcheck_test = healthcheck_test.copy() # If it's a list, first item is either NONE, CMD or CMD-SHELL. @@ -1032,12 +1031,12 @@ async def container_to_args(compose, cnt, detached=True): podman_args.append("--no-healthcheck") elif healthcheck_type == "CMD": cmd_q = "' '".join([cmd_quote(i) for i in healthcheck_test]) - podman_args.extend(["--healthcheck-command", "/bin/sh -c " + cmd_q]) + podman_args.extend(["--health-cmd", "/bin/sh -c " + cmd_q]) elif healthcheck_type == "CMD-SHELL": if len(healthcheck_test) != 1: raise ValueError("'CMD_SHELL' takes a single string after it") cmd_q = cmd_quote(healthcheck_test[0]) - podman_args.extend(["--healthcheck-command", "/bin/sh -c " + cmd_q]) + podman_args.extend(["--health-cmd", "/bin/sh -c " + cmd_q]) else: raise ValueError( f"unknown healthcheck test type [{healthcheck_type}],\ @@ -1048,15 +1047,15 @@ async def container_to_args(compose, cnt, detached=True): # interval, timeout and start_period are specified as durations. if "interval" in healthcheck: - podman_args.extend(["--healthcheck-interval", healthcheck["interval"]]) + podman_args.extend(["--health-interval", healthcheck["interval"]]) if "timeout" in healthcheck: - podman_args.extend(["--healthcheck-timeout", healthcheck["timeout"]]) + podman_args.extend(["--health-timeout", healthcheck["timeout"]]) if "start_period" in healthcheck: - podman_args.extend(["--healthcheck-start-period", healthcheck["start_period"]]) + podman_args.extend(["--health-start-period", healthcheck["start_period"]]) # convert other parameters to string if "retries" in healthcheck: - podman_args.extend(["--healthcheck-retries", str(healthcheck["retries"])]) + podman_args.extend(["--health-retries", str(healthcheck["retries"])]) # handle podman extension x_podman = cnt.get("x-podman", None)