Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1796989

Summary: SSSDConfig.save_domain(domain) does not always remove all entries removed from domain
Product: Red Hat Enterprise Linux 8 Reporter: François Cami <fcami>
Component: sssdAssignee: Pavel Březina <pbrezina>
Status: CLOSED ERRATA QA Contact: sssd-qe <sssd-qe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.2CC: amore, atikhono, fcami, grajaiya, ipa-qe, jhrozek, ksiddiqu, lslebodn, mniranja, mzidek, pbrezina, rcritten, sgoveas, sorlov, thalman, tscherf
Target Milestone: rcKeywords: Regression, Triaged
Target Release: 8.2Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: sync-to-jira
Fixed In Version: sssd-2.3.0-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1790886 Environment:
Last Closed: 2020-11-04 02:04:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1790886    

Description François Cami 2020-01-31 17:04:07 UTC
+++ This bug was initially created as a clone of Bug #1790886 +++

Description of problem:
If you repeatedly install and uninstall automount using ipa-client-automount, installation stops working.

Version-Release number of selected component (if applicable):
# cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.2 Beta (Ootpa)

# rpm -q ipa-client
ipa-client-4.8.4-2.module+el8.2.0+5265+c70de5c4.x86_64


How reproducible:
Always

Steps to Reproduce:
1. Execute commands:
ipa-client-automount --location default -U; echo $?
ipa-client-automount --uninstall -U; echo $?
ipa-client-automount --location default -U; echo $?
ipa-client-automount --uninstall -U; echo $?
ipa-client-automount --location default -U; echo $?


Actual results:
...
Searching for IPA server...
IPA server: DNS discovery
Location: default
Configured /etc/idmapd.conf
An automount location is already configured
3

Expected results:
Searching for IPA server...
IPA server: DNS discovery
Location: default
Configured /etc/idmapd.conf
Restarting sssd, waiting for it to become available.
Started autofs
0

Additional info:

The bug is not present in 
 - RHEL8.1 (release RHEL-8.1.0-20191015.0, ipa-client-4.8.0-11.module+el8.1.0+4247+9f3fd721.x86_64)
 - Fedora 30 (freeipa-client-4.8.3-1.fc30.x86_64) 

Full output of reproducer script:
[root@master1 vagrant]# ipa-client-automount --location default -U; echo $?
Searching for IPA server...
IPA server: DNS discovery
Location: default
Configured /etc/idmapd.conf
Restarting sssd, waiting for it to become available.
Started autofs
0
[root@master1 vagrant]# ipa-client-automount --uninstall -U; echo $?
Restoring configuration
0
[root@master1 vagrant]# ipa-client-automount --location default -U; echo $?
Searching for IPA server...
IPA server: DNS discovery
Location: default
Configured /etc/idmapd.conf
Restarting sssd, waiting for it to become available.
Started autofs
0
[root@master1 vagrant]# ipa-client-automount --uninstall -U; echo $?
Restoring configuration
0
[root@master1 vagrant]# ipa-client-automount --location default -U; echo $?
Searching for IPA server...
IPA server: DNS discovery
Location: default
Configured /etc/idmapd.conf
An automount location is already configured
3

--- Additional comment from anuja on 2020-01-27 08:18:08 UTC ---

Also downstream bash:ipa-clirent-automount is failing.
Adding regression label.

--- Additional comment from François Cami on 2020-01-28 12:35:45 UTC ---

Taking for investigation.

--- Additional comment from François Cami on 2020-01-30 12:45:33 UTC ---

This is due to ipa-client-automount not removing the following line from sssd.conf:

ipa_automount_location = default

Removing this line and launching "ipa-client-automount --location default -U" works.

--- Additional comment from François Cami on 2020-01-30 17:14:29 UTC ---

The issue (ipa_automount_location configuration entry not removed from sssd.conf) is also present upstream.

The following patch fixes it on my RHEL 8.2 Beta test system:

diff --git a/ipaclient/install/ipa_client_automount.py b/ipaclient/install/ipa_client_automount.py
index 3ef257a43..fdf974d0d 100644
--- a/ipaclient/install/ipa_client_automount.py
+++ b/ipaclient/install/ipa_client_automount.py
@@ -355,9 +355,10 @@ def uninstall(fstore, statestore):
                         continue
                     if provider == "ipa":
                         domain.remove_option('ipa_automount_location')
+                        sssdconfig.save_domain(domain)
                         domain.remove_provider('autofs')
+                        sssdconfig.save_domain(domain)
                         break
-                sssdconfig.save_domain(domain)
                 sssdconfig.write(paths.SSSD_CONF)
                 sssd = services.service('sssd', api)
                 sssd.restart()

Switching to ASSIGNED. This requires adapting ipatests properly.

Comment 1 François Cami 2020-01-31 17:05:20 UTC
This is reproductible without using IPA.
The upstream issue at https://pagure.io/SSSD/sssd/issue/4149#comment-623734 contains a reproducer: a sample configuration file and the associated code snippet.

Comment 2 Pavel Březina 2020-02-14 11:41:32 UTC
* `master`
    * 2014d8f52ea6a9d086b25f8f0c5b8e6b1e1c161d - Update __init__.py.in

Comment 9 Niranjan Mallapadi Raghavender 2020-07-07 19:07:58 UTC
Versions: sssd-2.3.0-4.el8.x86_64

ipa-client-automount --location default -U --server master.testrealm.test
IPA server: master.testrealm.test
Location: default
Configured /etc/idmapd.conf
Restarting sssd, waiting for it to become available.
Started autofs
Exit code: 0

ipa-client-automount --uninstall -U --server master.testrealm.test
Restoring configuration
Exit code: 0

ipa-client-automount --location default -U --server master.testrealm.test
IPA server: master.testrealm.test
Location: default
Configured /etc/idmapd.conf
Restarting sssd, waiting for it to become available.
Started autofs
Exit code: 0

ipa-client-automount --uninstall -U --server master.testrealm.test
Restoring configuration
Exit code: 0

ipa-client-automount --location default -U --server master.testrealm.test
IPA server: master.testrealm.test
Location: default
Configured /etc/idmapd.conf
Restarting sssd, waiting for it to become available.
Started autofs
Exit code: 0

ipa-client-automount --uninstall -U --server master.testrealm.test
Restoring configuration
Exit code: 0

ipa-client-automount --location default -U --server master.testrealm.test
RUN ipa-client-automount --location default -U --server master.testrealm.test
IPA server: master.testrealm.test
Location: default
Configured /etc/idmapd.conf
Restarting sssd, waiting for it to become available.
Started autofs
Exit code: 0

ipa-client-automount --uninstall -U --server master.testrealm.test
Restoring configuration
Exit code: 0

ipa-client-automount --location default -U --server master.testrealm.test
IPA server: master.testrealm.test
Location: default
Configured /etc/idmapd.conf
Restarting sssd, waiting for it to become available.
Started autofs
Exit code: 0

ipa-client-automount --uninstall -U --server master.testrealm.test
Restoring configuration
Exit code: 0

Comment 12 errata-xmlrpc 2020-11-04 02:04:37 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (sssd bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:4569