clear sssd cache when uninstalling client

The SSSD cache is not cleared when uninstalling an IPA client. For tidiness we should wipe the cache. This can be done with sssctl.
Note that this tool is in sssd-tools which is not currently a dependency.

Resolves: https://pagure.io/freeipa/issue/7376
Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
amitkuma
2018-01-30 17:44:01 +05:30
committed by Christian Heimes
parent 1fe795b75b
commit ccec8c6c41
3 changed files with 10 additions and 1 deletions

View File

@@ -149,6 +149,7 @@ BuildRequires: nss-devel
BuildRequires: openssl-devel BuildRequires: openssl-devel
BuildRequires: libini_config-devel BuildRequires: libini_config-devel
BuildRequires: cyrus-sasl-devel BuildRequires: cyrus-sasl-devel
BuildRequires: sssd-tools
%if ! %{ONLY_CLIENT} %if ! %{ONLY_CLIENT}
# 1.3.3.9: DS_Sleep (https://fedorahosted.org/389/ticket/48005) # 1.3.3.9: DS_Sleep (https://fedorahosted.org/389/ticket/48005)
BuildRequires: 389-ds-base-devel >= 1.3.3.9 BuildRequires: 389-ds-base-devel >= 1.3.3.9

View File

@@ -3140,6 +3140,14 @@ def uninstall(options):
remove_file(paths.SSSD_MC_GROUP) remove_file(paths.SSSD_MC_GROUP)
remove_file(paths.SSSD_MC_PASSWD) remove_file(paths.SSSD_MC_PASSWD)
try:
run([paths.SSSCTL, "cache-remove", "-o", "--stop", "--start"])
except Exception:
logger.info(
"An error occurred while removing SSSD's cache."
"Please remove the cache manually by executing "
"sssctl cache-remove -o.")
if ipa_domain: if ipa_domain:
sssd_domain_ldb = "cache_" + ipa_domain + ".ldb" sssd_domain_ldb = "cache_" + ipa_domain + ".ldb"
sssd_ldb_file = os.path.join(paths.SSSD_DB, sssd_domain_ldb) sssd_ldb_file = os.path.join(paths.SSSD_DB, sssd_domain_ldb)

View File

@@ -378,6 +378,6 @@ class BasePathNamespace(object):
KEYCTL = '/usr/bin/keyctl' KEYCTL = '/usr/bin/keyctl'
GETENT = '/usr/bin/getent' GETENT = '/usr/bin/getent'
SSHD = '/usr/sbin/sshd' SSHD = '/usr/sbin/sshd'
SSSCTL = '/usr/sbin/sssctl'
paths = BasePathNamespace() paths = BasePathNamespace()