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

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