From 7da61eab190899af72947ce8a51f878247d59894 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Fri, 24 Jul 2020 11:07:40 -0400 Subject: [PATCH] Add patches to fix behavior when all IPA services are stopped - Don't collect IPA servers in MetaCheck - Skip if dirsrv not available in IPAMetaCheck --- ...ect-the-list-of-masters-in-MetaCheck.patch | 41 +++++++++++++++++++ ...srv-be-running-to-run-the-IPAMetaChe.patch | 29 +++++++++++++ freeipa-healthcheck.spec | 8 +++- 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 0002-Don-t-collect-the-list-of-masters-in-MetaCheck.patch create mode 100644 0003-Require-that-dirsrv-be-running-to-run-the-IPAMetaChe.patch diff --git a/0002-Don-t-collect-the-list-of-masters-in-MetaCheck.patch b/0002-Don-t-collect-the-list-of-masters-in-MetaCheck.patch new file mode 100644 index 0000000..2b22956 --- /dev/null +++ b/0002-Don-t-collect-the-list-of-masters-in-MetaCheck.patch @@ -0,0 +1,41 @@ +From f78a6c7297375b4721835bae2f33bf0ed34a0586 Mon Sep 17 00:00:00 2001 +From: Rob Crittenden +Date: Wed, 15 Jul 2020 16:47:22 -0400 +Subject: [PATCH] Don't collect the list of masters in MetaCheck + +It is already collected in IPAMetaCheck. + +Signed-off-by: Rob Crittenden +--- + src/ipahealthcheck/meta/core.py | 8 -------- + 1 file changed, 8 deletions(-) + +diff --git a/src/ipahealthcheck/meta/core.py b/src/ipahealthcheck/meta/core.py +index 491a4f0..c021b79 100644 +--- a/src/ipahealthcheck/meta/core.py ++++ b/src/ipahealthcheck/meta/core.py +@@ -7,21 +7,13 @@ from ipahealthcheck.core import constants + from ipahealthcheck.core.plugin import Result, duration + from ipahealthcheck.meta.plugin import Plugin, registry + from ipapython.version import VERSION, API_VERSION +-from ipapython.dn import DN +-from ipalib import api + + + @registry + class MetaCheck(Plugin): + @duration + def check(self): +- conn = api.Backend.ldap2 +- masters_dn = DN(api.env.container_masters, api.env.basedn) +- masters = conn.get_entries(masters_dn, conn.SCOPE_ONELEVEL) +- known = [master.single_value['cn'] for master in masters] +- + yield Result(self, constants.SUCCESS, + fqdn=socket.getfqdn(), +- masters=known, + ipa_version=VERSION, + ipa_api_version=API_VERSION,) +-- +2.25.4 + diff --git a/0003-Require-that-dirsrv-be-running-to-run-the-IPAMetaChe.patch b/0003-Require-that-dirsrv-be-running-to-run-the-IPAMetaChe.patch new file mode 100644 index 0000000..4aa5955 --- /dev/null +++ b/0003-Require-that-dirsrv-be-running-to-run-the-IPAMetaChe.patch @@ -0,0 +1,29 @@ +From 4cb249430141fdc27d84ee796149a14b7e83afb5 Mon Sep 17 00:00:00 2001 +From: Rob Crittenden +Date: Thu, 23 Jul 2020 17:07:43 -0400 +Subject: [PATCH] Require that dirsrv be running to run the IPAMetaCheck + +Without it we don't have an LDAP connection to collect the +list of servers. + +Signed-off-by: Rob Crittenden +--- + src/ipahealthcheck/ipa/meta.py | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/ipahealthcheck/ipa/meta.py b/src/ipahealthcheck/ipa/meta.py +index caf27ea..e4ca323 100644 +--- a/src/ipahealthcheck/ipa/meta.py ++++ b/src/ipahealthcheck/ipa/meta.py +@@ -11,6 +11,8 @@ from ipalib import api + @registry + class IPAMetaCheck(IPAPlugin): + """Return meta data for the IPA installation""" ++ requires = ('dirsrv',) ++ + @duration + def check(self): + try: +-- +2.25.4 + diff --git a/freeipa-healthcheck.spec b/freeipa-healthcheck.spec index c13a94a..acc50a3 100644 --- a/freeipa-healthcheck.spec +++ b/freeipa-healthcheck.spec @@ -9,7 +9,7 @@ Name: %{project}-%{shortname} Version: 0.6 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Health check tool for %{projectname} BuildArch: noarch License: GPLv3 @@ -18,6 +18,8 @@ Source0: https://github.com/freeipa/freeipa-healthcheck/archive/%{version Source1: %{longname}.conf Patch0001: 0001-Remove-ipaclustercheck.patch +Patch0002: 0002-Don-t-collect-the-list-of-masters-in-MetaCheck.patch +Patch0003: 0003-Require-that-dirsrv-be-running-to-run-the-IPAMetaChe.patch Requires: %{project}-server Requires: python3-ipalib @@ -131,6 +133,10 @@ install -p -m644 %{_builddir}/%{project}-%{shortname}-%{version}/man/man5/%{long %changelog +* Fri Jul 24 2020 Rob Crittenden - 0.6-2 +- Don't collect IPA servers in MetaCheck +- Skip if dirsrv not available in IPAMetaCheck + * Wed Jul 1 2020 Rob Crittenden - 0.6-1 - Update to upstream 0.6 - Don't include cluster checking yet