From 203b7d1cb5c96fffac7f29238bf1ceea882dcd7d Mon Sep 17 00:00:00 2001 From: Stanislav Levin Date: Jan 30 2023 20:26:24 +0000 Subject: ipatests: healthcheck: Handle missing fips-mode-setup freeipa-healthcheck prechecks existance of `fips-mode-setup` and reports if it's missing: > "fips": "missing /bin/fips-mode-setup" Fixes: https://pagure.io/freeipa/issue/9315 Signed-off-by: Stanislav Levin Reviewed-By: Rob Crittenden --- diff --git a/ipatests/test_integration/test_ipahealthcheck.py b/ipatests/test_integration/test_ipahealthcheck.py index 7de247b..49a5779 100644 --- a/ipatests/test_integration/test_ipahealthcheck.py +++ b/ipatests/test_integration/test_ipahealthcheck.py @@ -353,15 +353,19 @@ class TestIpaHealthCheck(IntegrationTest): failures_only=False) assert returncode == 0 - cmd = self.master.run_command(['fips-mode-setup', '--is-enabled'], - raiseonerr=False) + cmd = self.master.run_command( + [paths.FIPS_MODE_SETUP, "--is-enabled"], raiseonerr=False + ) returncode = cmd.returncode - # If this produces IndexError, the check does not exist + assert "fips" in check[0]["kw"] + if check[0]["kw"]["fips"] == "disabled": assert returncode == 2 elif check[0]["kw"]["fips"] == "enabled": assert returncode == 0 + elif check[0]["kw"]["fips"] == f"missing {paths.FIPS_MODE_SETUP}": + assert returncode == 127 else: assert returncode == 1