summaryrefslogtreecommitdiffstats
path: root/install
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 /install
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 'install')
-rwxr-xr-xinstall/tools/ipa-server-install27
-rwxr-xr-xinstall/tools/ipactl3
2 files changed, 27 insertions, 3 deletions
diff --git a/install/tools/ipa-server-install b/install/tools/ipa-server-install
index c87ba9e..3828a9c 100755
--- a/install/tools/ipa-server-install
+++ b/install/tools/ipa-server-install
@@ -428,6 +428,8 @@ def check_dirsrv(unattended):
def uninstall():
+ rv = 0
+
print "Shutting down all IPA services"
try:
(stdout, stderr, rc) = run(["/usr/sbin/ipactl", "stop"], raiseonerr=False)
@@ -441,6 +443,7 @@ def uninstall():
logging.debug("ipa-client-install returned %d" % rc)
raise RuntimeError(stdout)
except Exception, e:
+ rv = 1
print "Uninstall of client side components failed!"
print "ipa-client-install returned: " + str(e)
@@ -474,12 +477,32 @@ def uninstall():
ipautil.run(["/usr/sbin/groupdel", dsinstance.DS_GROUP])
except ipautil.CalledProcessError, e:
logging.critical("failed to delete group %s" % e)
+ rv = 1
except KeyError:
logging.info("Group %s already removed", dsinstance.DS_GROUP)
service.chkconfig_off('ipa')
- return 0
+ # Now for some sanity checking. Make sure everything was really
+ # uninstalled.
+ serverids = dsinstance.check_existing_installation()
+ if len(serverids):
+ rv = 1
+ logging.error('IPA cannot be re-installed without removing existing 389-ds instance(s)')
+
+ if fstore.has_files():
+ logging.error('Some files have not been restored, see /var/lib/ipa/sysrestore/sysrestore.index')
+ has_state = False
+ for module in IPA_MODULES: # from installutils
+ if sstore.has_state(module):
+ logging.error('Some installation state for %s has not been restored, see /var/lib/ipa/sysrestore/sysrestore.state' % module)
+ has_state = True
+ rv = 1
+
+ if has_state:
+ logging.warn('Some installation state has not been restored.\nThis will cause re-installation to fail.\nIt should be safe to remove /var/lib/ipa/sysrestore.state but it may\nmean your system hasn\'t be restored to its pre-installation state.')
+
+ return rv
def set_subject_in_config(realm_name, dm_password, suffix, subject_base):
@@ -518,7 +541,7 @@ def main():
else:
standard_logging_setup("/var/log/ipaserver-install.log", options.debug)
print "\nThe log file for this installation can be found in /var/log/ipaserver-install.log"
- if not options.external_ca and not options.external_cert_file and (dsinstance.DsInstance().is_configured() or cainstance.CADSInstance().is_configured()):
+ if not options.external_ca and not options.external_cert_file and is_ipa_configured():
sys.exit("IPA server is already configured on this system.\n"
+ "If you want to reinstall the IPA server please uninstall it first.")
diff --git a/install/tools/ipactl b/install/tools/ipactl
index 313b876..f7b2adc 100755
--- a/install/tools/ipactl
+++ b/install/tools/ipactl
@@ -23,6 +23,7 @@ try:
import os
from ipaserver.install import service
from ipaserver.install.dsinstance import config_dirname, realm_to_serverid
+ from ipaserver.install.installutils import is_ipa_configured
from ipapython import sysrestore
from ipapython import config
from ipalib import api, errors
@@ -51,7 +52,7 @@ class IpactlError(StandardError):
return self.msg
def check_IPA_configuration():
- if not sysrestore.FileStore('/var/lib/ipa/sysrestore').has_files():
+ if not is_ipa_configured():
# LSB status code 6: program is not configured
raise IpactlError("IPA is not configured " +
"(see man pages of ipa-server-install for help)", 6)