Cleanup and remove more files on uninstall

* /etc/nsswitch.conf.ipabkp
* /etc/openldap/ldap.conf.ipabkp
* /var/lib/ipa/sysrestore/*
* /var/named/dyndb-ldap/ipa/
* /var/lib/dirsrv/scripts-%s/

See: https://pagure.io/freeipa/issue/2694
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
Christian Heimes
2018-03-28 21:18:48 +02:00
parent 70c6da9c54
commit 64438f8619
4 changed files with 18 additions and 2 deletions
+2
View File
@@ -1204,6 +1204,8 @@ class BindInstance(service.Service):
except ValueError as error:
logger.debug('%s', error)
installutils.rmtree(paths.BIND_LDAP_DNS_IPA_WORKDIR)
# disabled by default, by ldap_enable()
if enabled:
self.enable()
+8 -2
View File
@@ -1055,12 +1055,18 @@ class DsInstance(service.Service):
logger.debug("Removing DS instance %s", serverid)
try:
remove_ds_instance(serverid)
installutils.remove_keytab(paths.DS_KEYTAB)
installutils.remove_ccache(run_as=DS_USER)
except ipautil.CalledProcessError:
logger.error("Failed to remove DS instance. You may "
"need to remove instance data manually")
installutils.remove_keytab(paths.DS_KEYTAB)
installutils.remove_ccache(run_as=DS_USER)
# Remove scripts dir
scripts = paths.VAR_LIB_DIRSRV_INSTANCE_SCRIPTS_TEMPLATE % (
serverid)
installutils.rmtree(scripts)
# Just eat this state
self.restore_state("user_exists")
+4
View File
@@ -1150,6 +1150,10 @@ def uninstall(installer):
'but it may\n'
'mean your system hasn\'t be restored to its '
'pre-installation state.', SYSRESTORE_DIR_PATH)
else:
# sysrestore.state has no state left, remove it
sysrestore = os.path.join(SYSRESTORE_DIR_PATH, 'sysrestore.state')
installutils.remove_file(sysrestore)
# Note that this name will be wrong after the first uninstall.
dirname = dsinstance.config_dirname(