Skip to content

Commit ec5e1e3

Browse files
committed
T6686: adds explicit disable option
1 parent f790046 commit ec5e1e3

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

interface-definitions/container.xml.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,12 @@
561561
<help>Configure health check for the container</help>
562562
</properties>
563563
<children>
564+
<leafNode name="disable">
565+
<properties>
566+
<help>Disable health check if container has one defined</help>
567+
<valueless/>
568+
</properties>
569+
</leafNode>
564570
<leafNode name="command">
565571
<properties>
566572
<help>Health check command to run for the container</help>

smoketest/scripts/cli/test_container.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ def test_basic(self):
8383

8484
self.cli_set(base_path + ['name', cont_name, 'image', busybox_image])
8585
self.cli_set(base_path + ['name', cont_name, 'allow-host-networks'])
86+
self.cli_set(base_path + ['name', cont_name, 'health-check', 'disable'])
8687
self.cli_set(
8788
base_path
8889
+ [
@@ -112,7 +113,7 @@ def test_basic(self):
112113

113114
l = cmd_to_json(f'sudo podman container inspect {cont_name}')
114115
self.assertEqual(l['HostConfig']['LogConfig']['Type'], 'journald')
115-
self.assertEqual(l['Config']['Healthcheck']['Test'], ['NONE'])
116+
self.assertIsNone(l['Config'].get('Healthcheck'))
116117

117118
def test_healthcheck(self):
118119
cont_name = 'health-test'

src/conf_mode/container.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,8 @@ def generate_run_arguments(name, container_config):
432432
if 'retries' in container_config['health_check']:
433433
health_rt = container_config['health_check']['retries']
434434
healthcheck += f' --health-retries={health_rt}'
435-
else:
436-
healthcheck = ' --no-healthcheck'
435+
if 'disable' in container_config['health_check']:
436+
health_check = f' --no-healthcheck'
437437

438438
command = ''
439439
if 'command' in container_config:

0 commit comments

Comments
 (0)