Skip to content

Commit 6372c0a

Browse files
Use new Podman flags for healthcheck
Signed-off-by: Robin Syl <[email protected]>
1 parent 121b5f6 commit 6372c0a

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
@@ -1016,10 +1016,9 @@ async def container_to_args(compose, cnt, detached=True):
10161016
# If it's a string, it's equivalent to specifying CMD-SHELL
10171017
if is_str(healthcheck_test):
10181018
# podman does not add shell to handle command with whitespace
1019-
podman_args.extend([
1020-
"--healthcheck-command",
1021-
"/bin/sh -c " + cmd_quote(healthcheck_test),
1022-
])
1019+
podman_args.extend(
1020+
["--health-cmd", "/bin/sh -c " + cmd_quote(healthcheck_test)]
1021+
)
10231022
elif is_list(healthcheck_test):
10241023
healthcheck_test = healthcheck_test.copy()
10251024
# If it's a list, first item is either NONE, CMD or CMD-SHELL.
@@ -1028,12 +1027,12 @@ async def container_to_args(compose, cnt, detached=True):
10281027
podman_args.append("--no-healthcheck")
10291028
elif healthcheck_type == "CMD":
10301029
cmd_q = "' '".join([cmd_quote(i) for i in healthcheck_test])
1031-
podman_args.extend(["--healthcheck-command", "/bin/sh -c " + cmd_q])
1030+
podman_args.extend(["--health-cmd", "/bin/sh -c " + cmd_q])
10321031
elif healthcheck_type == "CMD-SHELL":
10331032
if len(healthcheck_test) != 1:
10341033
raise ValueError("'CMD_SHELL' takes a single string after it")
10351034
cmd_q = cmd_quote(healthcheck_test[0])
1036-
podman_args.extend(["--healthcheck-command", "/bin/sh -c " + cmd_q])
1035+
podman_args.extend(["--health-cmd", "/bin/sh -c " + cmd_q])
10371036
else:
10381037
raise ValueError(
10391038
f"unknown healthcheck test type [{healthcheck_type}],\
@@ -1044,15 +1043,15 @@ async def container_to_args(compose, cnt, detached=True):
10441043

10451044
# interval, timeout and start_period are specified as durations.
10461045
if "interval" in healthcheck:
1047-
podman_args.extend(["--healthcheck-interval", healthcheck["interval"]])
1046+
podman_args.extend(["--health-interval", healthcheck["interval"]])
10481047
if "timeout" in healthcheck:
1049-
podman_args.extend(["--healthcheck-timeout", healthcheck["timeout"]])
1048+
podman_args.extend(["--health-timeout", healthcheck["timeout"]])
10501049
if "start_period" in healthcheck:
1051-
podman_args.extend(["--healthcheck-start-period", healthcheck["start_period"]])
1050+
podman_args.extend(["--health-start-period", healthcheck["start_period"]])
10521051

10531052
# convert other parameters to string
10541053
if "retries" in healthcheck:
1055-
podman_args.extend(["--healthcheck-retries", str(healthcheck["retries"])])
1054+
podman_args.extend(["--health-retries", str(healthcheck["retries"])])
10561055

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

0 commit comments

Comments
 (0)