FIX: Clear SSSD caches when uninstalling the client

https://fedorahosted.org/freeipa/ticket/5049

Reviewed-By: Simo Sorce <ssorce@redhat.com>
This commit is contained in:
Martin Basti authored and Tomas Babej committed 2015-07-07 16:27:24 +02:00
1 parent 12b053df30
commit 6fa123447f
1 file changed
+12 -7
+12 -7
View File
@@ -479,6 +479,7 @@ def uninstall(options, env):
statestore._load()
hostname = None
ipa_domain = None
was_sssd_configured = False
try:
sssdconfig = SSSDConfig.SSSDConfig()
@@ -503,6 +504,10 @@ def uninstall(options, env):
hostname = domain.get_option('ipa_hostname')
except SSSDConfig.NoOptionError:
continue
try:
ipa_domain = domain.get_option('ipa_domain')
except SSSDConfig.NoOptionError:
pass
except Exception, e:
# We were unable to read existing SSSD config. This might mean few things:
# - sssd wasn't installed
@@ -632,14 +637,14 @@ def uninstall(options, env):
remove_file(paths.SSSD_MC_GROUP)
remove_file(paths.SSSD_MC_PASSWD)
ipa_domain = domain.get_option('ipa_domain')
sssd_domain_ldb = "cache_" + ipa_domain + ".ldb"
sssd_ldb_file = os.path.join(paths.SSSD_DB, sssd_domain_ldb)
remove_file(sssd_ldb_file)
if ipa_domain:
sssd_domain_ldb = "cache_" + ipa_domain + ".ldb"
sssd_ldb_file = os.path.join(paths.SSSD_DB, sssd_domain_ldb)
remove_file(sssd_ldb_file)
sssd_domain_ccache = "ccache_" + ipa_domain.upper()
sssd_ccache_file = os.path.join(paths.SSSD_DB, sssd_domain_ccache)
remove_file(sssd_domain_ccache)
sssd_domain_ccache = "ccache_" + ipa_domain.upper()
sssd_ccache_file = os.path.join(paths.SSSD_DB, sssd_domain_ccache)
remove_file(sssd_ccache_file)
# Next if-elif-elif construction deals with sssd.conf file.
# Old pre-IPA domains are preserved due merging the old sssd.conf