summaryrefslogtreecommitdiffstats
path: root/ipaserver/install/dsinstance.py
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2011-08-29 11:16:52 -0400
committerRob Crittenden <rcritten@redhat.com>2011-08-29 16:49:52 -0400
commit91c9e8320932124ff77178383a0531fb2b218f2f (patch)
tree7b0b634de14e385f76cd9fddb5af6f9cad786fdf /ipaserver/install/dsinstance.py
parent28e6d137afa65f638ea6e748eb39bce9aa83e403 (diff)
downloadfreeipa-91c9e8320932124ff77178383a0531fb2b218f2f.zip
freeipa-91c9e8320932124ff77178383a0531fb2b218f2f.tar.gz
freeipa-91c9e8320932124ff77178383a0531fb2b218f2f.tar.xz
Add common is_installed() fn, better uninstall logging, check for errors.
The installer and ipactl used two different methods to determine whether IPA was configured, unify them. When uninstalling report any thing that looks suspicious and warn that a re-install may fail. This includes any remaining 389-ds instances and any state or files that remains after all the module uninstallers are complete. Add wrappers for removing files and directories to log failures. https://fedorahosted.org/freeipa/ticket/1715
Diffstat (limited to 'ipaserver/install/dsinstance.py')
-rw-r--r--ipaserver/install/dsinstance.py60
1 files changed, 20 insertions, 40 deletions
diff --git a/ipaserver/install/dsinstance.py b/ipaserver/install/dsinstance.py
index 5006083..7ca5db2 100644
--- a/ipaserver/install/dsinstance.py
+++ b/ipaserver/install/dsinstance.py
@@ -66,42 +66,24 @@ def schema_dirname(serverid):
return config_dirname(serverid) + "/schema/"
def erase_ds_instance_data(serverid):
- try:
- shutil.rmtree("/etc/dirsrv/slapd-%s" % serverid)
- except:
- pass
- try:
- shutil.rmtree("/usr/lib/dirsrv/slapd-%s" % serverid)
- except:
- pass
- try:
- shutil.rmtree("/usr/lib64/dirsrv/slapd-%s" % serverid)
- except:
- pass
- try:
- shutil.rmtree("/var/lib/dirsrv/slapd-%s" % serverid)
- except:
- pass
- try:
- shutil.rmtree("/var/lock/dirsrv/slapd-%s" % serverid)
- except:
- pass
- try:
- os.unlink("/var/run/slapd-%s.socket" % serverid)
- except:
- pass
- try:
- shutil.rmtree("/var/lib/dirsrv/scripts-%s" % serverid)
- except:
- pass
- try:
- os.unlink("/etc/dirsrv/ds.keytab")
- except:
- pass
- try:
- os.unlink("/etc/sysconfig/dirsrv-%s" % serverid)
- except:
- pass
+ installutils.rmtree("/etc/dirsrv/slapd-%s" % serverid)
+
+ installutils.rmtree("/usr/lib/dirsrv/slapd-%s" % serverid)
+
+ installutils.rmtree("/usr/lib64/dirsrv/slapd-%s" % serverid)
+
+ installutils.rmtree("/var/lib/dirsrv/slapd-%s" % serverid)
+
+ installutils.rmtree("/var/lock/dirsrv/slapd-%s" % serverid)
+
+ installutils.remove_file("/var/run/slapd-%s.socket" % serverid)
+
+ installutils.rmtree("/var/lib/dirsrv/scripts-%s" % serverid)
+
+ installutils.remove_file("/etc/dirsrv/ds.keytab")
+
+ installutils.remove_file("/etc/sysconfig/dirsrv-%s" % serverid)
+
# try:
# shutil.rmtree("/var/log/dirsrv/slapd-%s" % serverid)
# except:
@@ -114,6 +96,7 @@ def check_existing_installation():
serverids = []
for d in dirs:
+ logging.debug('Found existing 389-ds instance %s' % d)
serverids.append(os.path.basename(d).split("slapd-", 1)[1])
return serverids
@@ -672,10 +655,7 @@ class DsInstance(service.Service):
if user_exists == False:
pent = pwd.getpwnam(DS_USER)
- try:
- os.unlink("/var/tmp/ldap_%d" % pent.pw_uid)
- except:
- pass
+ installutils.remove_file("/var/tmp/ldap_%d" % pent.pw_uid)
try:
ipautil.run(["/usr/sbin/userdel", DS_USER])
except ipautil.CalledProcessError, e: