Blame SOURCES/0019-Don-t-depend-on-IPA-status-when-suppressing-pki-chec.patch

863b3c
From 62c14dbff5a947b50194df197de9f7052597ffb4 Mon Sep 17 00:00:00 2001
863b3c
From: Rob Crittenden <rcritten@redhat.com>
863b3c
Date: Thu, 17 Feb 2022 08:56:38 -0500
863b3c
Subject: [PATCH] Don't depend on IPA status when suppressing pki checks
863b3c
863b3c
The pki healthchecks are noisy if a CA is not configured. We
863b3c
want to suppresse these in IPA so don't make the checks visible
863b3c
if a CA is not configured.
863b3c
863b3c
So this means we need to be able to run in these conditions:
863b3c
863b3c
1. IPA is configured with a CA: the pki checks are run
863b3c
2. IPA is configured without a CA: the pki checks are not run
863b3c
3. IPA is not configured: the pki checks are run
863b3c
863b3c
Which basically equates to three states: True, False, None
863b3c
863b3c
This was done originally with the ca_configured variable set to
863b3c
None. Using some inside knowledge the registries are loaded which
863b3c
will set ca_configured to True or False in the IPA registry.
863b3c
Using that we can determine if the pki checks should be available.
863b3c
Unfortunately I changed the initialization to False so it always
863b3c
assumes that IPA is installed. ca_configured will be False for the
863b3c
case of IPA not installed instead of None so we can't handle that
863b3c
last state.
863b3c
863b3c
So initialize ca_configured to None so we can satisfy all three
863b3c
states.
863b3c
863b3c
Signed-off-by: Rob Crittenden <rcritten@redhat.com>
863b3c
---
863b3c
 src/ipahealthcheck/core/core.py | 22 ++++++++++++++++------
863b3c
 1 file changed, 16 insertions(+), 6 deletions(-)
863b3c
863b3c
diff --git a/src/ipahealthcheck/core/core.py b/src/ipahealthcheck/core/core.py
863b3c
index a6b4fe8..19f7818 100644
863b3c
--- a/src/ipahealthcheck/core/core.py
863b3c
+++ b/src/ipahealthcheck/core/core.py
863b3c
@@ -281,13 +281,23 @@ class RunChecks:
863b3c
         if rval is not None:
863b3c
             return rval
863b3c
 
863b3c
+        # The pki checks are noisy if a CA is not configured so we
863b3c
+        # want to suppress that for IPA.
863b3c
+        #
863b3c
+        # There are 3 possible states:
863b3c
+        # 1. IPA is configured with a CA
863b3c
+        # 2. IPA is configured without a CA
863b3c
+        # 3. IPA is not configured
863b3c
+        #
863b3c
         # If we have IPA configured without a CA then we want to skip
863b3c
-        # the pkihealthcheck plugins otherwise they will generated a
863b3c
-        # lot of false positives. The IPA plugins are loaded first so
863b3c
-        # which should set ca_configured in its registry to True or
863b3c
-        # False. We will skip the pkihealthcheck plugins only if
863b3c
-        # ca_configured is False which means that it was set by IPA.
863b3c
-        ca_configured = False
863b3c
+        # the pkihealthcheck plugins
863b3c
+        #
863b3c
+        # The IPA registry will set ca_configured in its registry to True
863b3c
+        # or False. We will skip the pkihealthcheck plugins only if
863b3c
+        # ca_configured is False which means that it was set by IPA. So
863b3c
+        # we initialize ca_configured to None so that the pki checks
863b3c
+        # will always be executed with pki-healthcheck.
863b3c
+        ca_configured = None
863b3c
         for name, registry in find_registries(self.entry_points).items():
863b3c
             try:
863b3c
                 registry.initialize(framework, config, options)
863b3c
-- 
863b3c
2.31.1
863b3c