Skip to content

Commit 44885b7

Browse files
Use new Podman flags for healthcheck
Signed-off-by: Robin Syl <robin@robinsyl.dev>
1 parent abb0cb1 commit 44885b7

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

podman_compose.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,10 +1020,9 @@ async def container_to_args(compose, cnt, detached=True):
10201020
# If it's a string, it's equivalent to specifying CMD-SHELL
10211021
if is_str(healthcheck_test):
10221022
# podman does not add shell to handle command with whitespace
1023-
podman_args.extend([
1024-
"--healthcheck-command",
1025-
"/bin/sh -c " + cmd_quote(healthcheck_test),
1026-
])
1023+
podman_args.extend(
1024+
["--health-cmd", "/bin/sh -c " + cmd_quote(healthcheck_test)]
1025+
)
10271026
elif is_list(healthcheck_test):
10281027
healthcheck_test = healthcheck_test.copy()
10291028
# 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):
10321031
podman_args.append("--no-healthcheck")
10331032
elif healthcheck_type == "CMD":
10341033
cmd_q = "' '".join([cmd_quote(i) for i in healthcheck_test])
1035-
podman_args.extend(["--healthcheck-command", "/bin/sh -c " + cmd_q])
1034+
podman_args.extend(["--health-cmd", "/bin/sh -c " + cmd_q])
10361035
elif healthcheck_type == "CMD-SHELL":
10371036
if len(healthcheck_test) != 1:
10381037
raise ValueError("'CMD_SHELL' takes a single string after it")
10391038
cmd_q = cmd_quote(healthcheck_test[0])
1040-
podman_args.extend(["--healthcheck-command", "/bin/sh -c " + cmd_q])
1039+
podman_args.extend(["--health-cmd", "/bin/sh -c " + cmd_q])
10411040
else:
10421041
raise ValueError(
10431042
f"unknown healthcheck test type [{healthcheck_type}],\
@@ -1048,15 +1047,15 @@ async def container_to_args(compose, cnt, detached=True):
10481047

10491048
# interval, timeout and start_period are specified as durations.
10501049
if "interval" in healthcheck:
1051-
podman_args.extend(["--healthcheck-interval", healthcheck["interval"]])
1050+
podman_args.extend(["--health-interval", healthcheck["interval"]])
10521051
if "timeout" in healthcheck:
1053-
podman_args.extend(["--healthcheck-timeout", healthcheck["timeout"]])
1052+
podman_args.extend(["--health-timeout", healthcheck["timeout"]])
10541053
if "start_period" in healthcheck:
1055-
podman_args.extend(["--healthcheck-start-period", healthcheck["start_period"]])
1054+
podman_args.extend(["--health-start-period", healthcheck["start_period"]])
10561055

10571056
# convert other parameters to string
10581057
if "retries" in healthcheck:
1059-
podman_args.extend(["--healthcheck-retries", str(healthcheck["retries"])])
1058+
podman_args.extend(["--health-retries", str(healthcheck["retries"])])
10601059

10611060
# handle podman extension
10621061
x_podman = cnt.get("x-podman", None)

0 commit comments

Comments
 (0)