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

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