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

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