Blame SOURCES/0005-ipa-client-automount-fails-after-repeated-installation-uninstallation_rhbz#1790886.patch

177dc6
From 6332aed9ba67e2ee759a9d988ba92139486469d4 Mon Sep 17 00:00:00 2001
177dc6
From: François Cami <fcami@redhat.com>
177dc6
Date: Feb 14 2020 16:38:19 +0000
177dc6
Subject: ipa-client-automount: call save_domain() for each change
177dc6
177dc6
177dc6
Call sssdconfig.save_domain(domain) after each configuration
177dc6
change during ipa-client-automount --uninstall.
177dc6
177dc6
Previously, sssdconfig.save_domain(domain) was called only
177dc6
outside of the domain detection loop which changed the domain
177dc6
configuration. This introduced issues as this method's behavior
177dc6
is only consistent when configuration items are removed in a
177dc6
certain order: https://pagure.io/SSSD/sssd/issue/4149
177dc6
Plus, it is more correct to save the configuration from within
177dc6
the loop if ever we support multiple domains.
177dc6
177dc6
Fixes: https://pagure.io/freeipa/issue/8190
177dc6
Signed-off-by: François Cami <fcami@redhat.com>
177dc6
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
177dc6
177dc6
---
177dc6
177dc6
diff --git a/ipaclient/install/ipa_client_automount.py b/ipaclient/install/ipa_client_automount.py
177dc6
index 3ef257a..fdf974d 100644
177dc6
--- a/ipaclient/install/ipa_client_automount.py
177dc6
+++ b/ipaclient/install/ipa_client_automount.py
177dc6
@@ -355,9 +355,10 @@ def uninstall(fstore, statestore):
177dc6
                         continue
177dc6
                     if provider == "ipa":
177dc6
                         domain.remove_option('ipa_automount_location')
177dc6
+                        sssdconfig.save_domain(domain)
177dc6
                         domain.remove_provider('autofs')
177dc6
+                        sssdconfig.save_domain(domain)
177dc6
                         break
177dc6
-                sssdconfig.save_domain(domain)
177dc6
                 sssdconfig.write(paths.SSSD_CONF)
177dc6
                 sssd = services.service('sssd', api)
177dc6
                 sssd.restart()
177dc6
177dc6
From 7ae804c726970ae467a7f76efa21bae40405551d Mon Sep 17 00:00:00 2001
177dc6
From: François Cami <fcami@redhat.com>
177dc6
Date: Feb 14 2020 16:38:19 +0000
177dc6
Subject: ipatests: make sure ipa-client-automount reverts sssd.conf
177dc6
177dc6
177dc6
Due to https://pagure.io/SSSD/sssd/issue/4149 ipa-client-automount
177dc6
fails to remove the ipa_automount_location entry from sssd.conf.
177dc6
Test that autofs_provider and ipa_automount_location are removed.
177dc6
177dc6
Fixes: https://pagure.io/freeipa/issue/8190
177dc6
Signed-off-by: François Cami <fcami@redhat.com>
177dc6
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
177dc6
177dc6
---
177dc6
177dc6
diff --git a/ipatests/test_integration/test_nfs.py b/ipatests/test_integration/test_nfs.py
177dc6
index 7d29836..532dd61 100644
177dc6
--- a/ipatests/test_integration/test_nfs.py
177dc6
+++ b/ipatests/test_integration/test_nfs.py
177dc6
@@ -332,6 +332,20 @@ class TestIpaClientAutomountFileRestore(IntegrationTest):
177dc6
             "ipa-client-automount", "--uninstall", "-U"
177dc6
         ])
177dc6
 
177dc6
+        if not no_sssd:
177dc6
+            # https://pagure.io/freeipa/issue/8190
177dc6
+            # check that no ipa_automount_location is left in sssd.conf
177dc6
+            # also check for autofs_provider for good measure
177dc6
+            grep_automount_in_sssdconf_cmd = \
177dc6
+                "egrep ipa_automount_location\\|autofs_provider " \
177dc6
+                "/etc/sssd/sssd.conf"
177dc6
+            cmd = self.clients[0].run_command(
177dc6
+                grep_automount_in_sssdconf_cmd, raiseonerr=False
177dc6
+            )
177dc6
+            assert cmd.returncode == 1, \
177dc6
+                "PG8190 regression found: ipa_automount_location still " \
177dc6
+                "present in sssd.conf"
177dc6
+
177dc6
         cmd = self.clients[0].run_command(grep_automount_command)
177dc6
         assert cmd.stdout_text.split() == after_ipa_client_install
177dc6
 
177dc6