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

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