Blame SOURCES/0009-Enable-the-ccache-sweep-timer-during-installation_rhbz#2051575.patch

b7b64b
From 9b6d0bb1245c4891ccc270f360d0f72a4b1444c1 Mon Sep 17 00:00:00 2001
b7b64b
From: Rob Crittenden <rcritten@redhat.com>
b7b64b
Date: Mon, 7 Feb 2022 10:39:55 -0500
b7b64b
Subject: [PATCH] Enable the ccache sweep timer during installation
b7b64b
b7b64b
The timer was only being enabled during package installation
b7b64b
if IPA was configured. So effectively only on upgrade.
b7b64b
b7b64b
Add as a separate installation step after the ccache directory
b7b64b
is configured.
b7b64b
b7b64b
Fixes: https://pagure.io/freeipa/issue/9107
b7b64b
b7b64b
Signed-off-by: Rob Crittenden <rcritten@redhat.com>
b7b64b
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
b7b64b
---
b7b64b
 ipaserver/install/httpinstance.py | 7 +++++++
b7b64b
 1 file changed, 7 insertions(+)
b7b64b
b7b64b
diff --git a/ipaserver/install/httpinstance.py b/ipaserver/install/httpinstance.py
b7b64b
index 732bb58d4..50ccf5e50 100644
b7b64b
--- a/ipaserver/install/httpinstance.py
b7b64b
+++ b/ipaserver/install/httpinstance.py
b7b64b
@@ -140,6 +140,8 @@ class HTTPInstance(service.Service):
b7b64b
         self.step("publish CA cert", self.__publish_ca_cert)
b7b64b
         self.step("clean up any existing httpd ccaches",
b7b64b
                   self.remove_httpd_ccaches)
b7b64b
+        self.step("enable ccache sweep",
b7b64b
+                  self.enable_ccache_sweep)
b7b64b
         self.step("configuring SELinux for httpd", self.configure_selinux_for_httpd)
b7b64b
         if not self.is_kdcproxy_configured():
b7b64b
             self.step("create KDC proxy config", self.create_kdcproxy_conf)
b7b64b
@@ -177,6 +179,11 @@ class HTTPInstance(service.Service):
b7b64b
             [paths.SYSTEMD_TMPFILES, '--create', '--prefix', paths.IPA_CCACHES]
b7b64b
         )
b7b64b
 
b7b64b
+    def enable_ccache_sweep(self):
b7b64b
+        ipautil.run(
b7b64b
+            [paths.SYSTEMCTL, 'enable', 'ipa-ccache-sweep.timer']
b7b64b
+        )
b7b64b
+
b7b64b
     def __configure_http(self):
b7b64b
         self.update_httpd_service_ipa_conf()
b7b64b
         self.update_httpd_wsgi_conf()
b7b64b
-- 
b7b64b
2.34.1
b7b64b
b7b64b
From 0d9eb3d515385412abefe9c33e0099ea14f33cbc Mon Sep 17 00:00:00 2001
b7b64b
From: Mohammad Rizwan <myusuf@redhat.com>
b7b64b
Date: Wed, 9 Feb 2022 18:56:21 +0530
b7b64b
Subject: [PATCH] Test ipa-ccache-sweep.timer enabled by default during
b7b64b
 installation
b7b64b
b7b64b
This test checks that ipa-ccache-sweep.timer is enabled by default
b7b64b
during the ipa installation.
b7b64b
b7b64b
related: https://pagure.io/freeipa/issue/9107
b7b64b
b7b64b
Signed-off-by: Mohammad Rizwan <myusuf@redhat.com>
b7b64b
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
b7b64b
---
b7b64b
 .../test_integration/test_installation.py     | 19 +++++++++++++++++--
b7b64b
 1 file changed, 17 insertions(+), 2 deletions(-)
b7b64b
b7b64b
diff --git a/ipatests/test_integration/test_installation.py b/ipatests/test_integration/test_installation.py
b7b64b
index f2d372c0c..63edbaa2b 100644
b7b64b
--- a/ipatests/test_integration/test_installation.py
b7b64b
+++ b/ipatests/test_integration/test_installation.py
b7b64b
@@ -475,7 +475,7 @@ class TestInstallCA(IntegrationTest):
b7b64b
 
b7b64b
         # Tweak sysrestore.state to drop installation section
b7b64b
         self.master.run_command(
b7b64b
-            ['sed','-i', r's/\[installation\]/\[badinstallation\]/',
b7b64b
+            ['sed', '-i', r's/\[installation\]/\[badinstallation\]/',
b7b64b
              os.path.join(paths.SYSRESTORE, SYSRESTORE_STATEFILE)])
b7b64b
 
b7b64b
         # Re-run installation check and it should fall back to old method
b7b64b
@@ -485,7 +485,7 @@ class TestInstallCA(IntegrationTest):
b7b64b
 
b7b64b
         # Restore installation section.
b7b64b
         self.master.run_command(
b7b64b
-            ['sed','-i', r's/\[badinstallation\]/\[installation\]/',
b7b64b
+            ['sed', '-i', r's/\[badinstallation\]/\[installation\]/',
b7b64b
              os.path.join(paths.SYSRESTORE, SYSRESTORE_STATEFILE)])
b7b64b
 
b7b64b
         # Uninstall and confirm that the old method reports correctly
b7b64b
@@ -690,6 +690,7 @@ def get_pki_tomcatd_pid(host):
b7b64b
             break
b7b64b
     return(pid)
b7b64b
 
b7b64b
+
b7b64b
 def get_ipa_services_pids(host):
b7b64b
     ipa_services_name = [
b7b64b
         "krb5kdc", "kadmin", "named", "httpd", "ipa-custodia",
b7b64b
@@ -1309,6 +1310,20 @@ class TestInstallMasterKRA(IntegrationTest):
b7b64b
     def test_install_master(self):
b7b64b
         tasks.install_master(self.master, setup_dns=False, setup_kra=True)
b7b64b
 
b7b64b
+    def test_ipa_ccache_sweep_timer_enabled(self):
b7b64b
+        """Test ipa-ccache-sweep.timer enabled by default during installation
b7b64b
+
b7b64b
+        This test checks that ipa-ccache-sweep.timer is enabled by default
b7b64b
+        during the ipa installation.
b7b64b
+
b7b64b
+        related: https://pagure.io/freeipa/issue/9107
b7b64b
+        """
b7b64b
+        result = self.master.run_command(
b7b64b
+            ['systemctl', 'is-enabled', 'ipa-ccache-sweep.timer'],
b7b64b
+            raiseonerr=False
b7b64b
+        )
b7b64b
+        assert 'enabled' in result.stdout_text
b7b64b
+
b7b64b
     def test_install_dns(self):
b7b64b
         tasks.install_dns(self.master)
b7b64b
 
b7b64b
-- 
b7b64b
2.34.1
b7b64b