Skip to content

Commit 09e1274

Browse files
recursiveribbonsmokibit
authored andcommitted
Use new Podman flags for healthcheck
Relevant Podman documentation here: https://docs.podman.io/en/v5.4.0/markdown/podman-healthcheck-run.1.html Signed-off-by: Robin Syl <[email protected]> Signed-off-by: Monika Kairaityte <[email protected]>
1 parent 036c0dc commit 09e1274

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

podman_compose.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,7 +1280,7 @@ async def container_to_args(
12801280
if isinstance(healthcheck_test, str):
12811281
# podman does not add shell to handle command with whitespace
12821282
podman_args.extend([
1283-
"--healthcheck-command",
1283+
"--health-cmd",
12841284
json.dumps(["CMD-SHELL", healthcheck_test]),
12851285
])
12861286
elif is_list(healthcheck_test):
@@ -1290,11 +1290,11 @@ async def container_to_args(
12901290
if healthcheck_type == "NONE":
12911291
podman_args.append("--no-healthcheck")
12921292
elif healthcheck_type == "CMD":
1293-
podman_args.extend(["--healthcheck-command", json.dumps(healthcheck_test)])
1293+
podman_args.extend(["--health-cmd", json.dumps(healthcheck_test)])
12941294
elif healthcheck_type == "CMD-SHELL":
12951295
if len(healthcheck_test) != 1:
12961296
raise ValueError("'CMD_SHELL' takes a single string after it")
1297-
podman_args.extend(["--healthcheck-command", json.dumps(healthcheck_test)])
1297+
podman_args.extend(["--health-cmd", json.dumps(healthcheck_test)])
12981298
else:
12991299
raise ValueError(
13001300
f"unknown healthcheck test type [{healthcheck_type}],\
@@ -1305,15 +1305,15 @@ async def container_to_args(
13051305

13061306
# interval, timeout and start_period are specified as durations.
13071307
if "interval" in healthcheck:
1308-
podman_args.extend(["--healthcheck-interval", healthcheck["interval"]])
1308+
podman_args.extend(["--health-interval", healthcheck["interval"]])
13091309
if "timeout" in healthcheck:
1310-
podman_args.extend(["--healthcheck-timeout", healthcheck["timeout"]])
1310+
podman_args.extend(["--health-timeout", healthcheck["timeout"]])
13111311
if "start_period" in healthcheck:
1312-
podman_args.extend(["--healthcheck-start-period", healthcheck["start_period"]])
1312+
podman_args.extend(["--health-start-period", healthcheck["start_period"]])
13131313

13141314
# convert other parameters to string
13151315
if "retries" in healthcheck:
1316-
podman_args.extend(["--healthcheck-retries", str(healthcheck["retries"])])
1316+
podman_args.extend(["--health-retries", str(healthcheck["retries"])])
13171317

13181318
# handle podman extension
13191319
if 'x-podman' in cnt:

tests/unit/test_container_to_args.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ async def test_healthcheck_string(self) -> None:
823823
"--name=project_name_service_name1",
824824
"-d",
825825
"--network=bridge:alias=service_name",
826-
"--healthcheck-command",
826+
"--health-cmd",
827827
'["CMD-SHELL", "cmd arg1 arg2"]',
828828
"busybox",
829829
],
@@ -843,7 +843,7 @@ async def test_healthcheck_cmd_args(self) -> None:
843843
"--name=project_name_service_name1",
844844
"-d",
845845
"--network=bridge:alias=service_name",
846-
"--healthcheck-command",
846+
"--health-cmd",
847847
'["cmd", "arg1", "arg2"]',
848848
"busybox",
849849
],
@@ -863,7 +863,7 @@ async def test_healthcheck_cmd_shell(self) -> None:
863863
"--name=project_name_service_name1",
864864
"-d",
865865
"--network=bridge:alias=service_name",
866-
"--healthcheck-command",
866+
"--health-cmd",
867867
'["cmd arg1 arg2"]',
868868
"busybox",
869869
],

0 commit comments

Comments
 (0)