diff options
author | Rob Crittenden <rcritten@redhat.com> | 2010-05-03 15:21:51 -0400 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2010-05-03 13:41:18 -0600 |
commit | 04e9056ec2b6e0360f3f3545fd638ecc17aaad2c (patch) | |
tree | b9fefef29f7ba68c1932aac39f7b2bedfc85d356 /ipaserver/install/cainstance.py | |
parent | 6d35812252cb4fcf34cf13bf88cbb705560afc3a (diff) | |
download | freeipa.git-04e9056ec2b6e0360f3f3545fd638ecc17aaad2c.tar.gz freeipa.git-04e9056ec2b6e0360f3f3545fd638ecc17aaad2c.tar.xz freeipa.git-04e9056ec2b6e0360f3f3545fd638ecc17aaad2c.zip |
Make the installer/uninstaller more aware of its state
We have had a state file for quite some time that is used to return
the system to its pre-install state. We can use that to determine what
has been configured.
This patch:
- uses the state file to determine if dogtag was installed
- prevents someone from trying to re-install an installed server
- displays some output when uninstalling
- re-arranges the ipa_kpasswd installation so the state is properly saved
- removes pkiuser if it was added by the installer
- fetches and installs the CA on both masters and clients
Diffstat (limited to 'ipaserver/install/cainstance.py')
-rw-r--r-- | ipaserver/install/cainstance.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/ipaserver/install/cainstance.py b/ipaserver/install/cainstance.py index bb7e00e2..9e55333d 100644 --- a/ipaserver/install/cainstance.py +++ b/ipaserver/install/cainstance.py @@ -336,6 +336,9 @@ class CADSInstance(service.Service): logging.critical("Failed to restart the directory server. See the installation log for details.") def uninstall(self): + if self.is_configured(): + self.print_msg("Unconfiguring CA directory server") + running = self.restore_state("running") enabled = self.restore_state("enabled") serverid = self.restore_state("serverid") @@ -351,6 +354,7 @@ class CADSInstance(service.Service): if not serverid is None: dsinstance.erase_ds_instance_data(serverid) + self.service_name="pkids" ds_user = self.restore_state("user") user_exists = self.restore_state("user_exists") @@ -1028,6 +1032,13 @@ class CAInstance(service.Service): self.__restart_instance() def uninstall(self): + if self.is_configured(): + self.print_msg("Unconfiguring CA") + + enabled = self.restore_state("enabled") + if not enabled is None and not enabled: + self.chkconfig_off() + try: ipautil.run(["/usr/bin/pkiremove", "-pki_instance_root=/var/lib", "-pki_instance_name=%s" % PKI_INSTANCE_NAME, "--force"]) @@ -1039,6 +1050,14 @@ class CAInstance(service.Service): except ipautil.CalledProcessError, e: pass + pki_user = self.restore_state("user") + user_exists = self.restore_state("user_exists") + if not pki_user is None and not user_exists is None and not user_exists: + try: + ipautil.run(["/usr/sbin/userdel", pki_user]) + except ipautil.CalledProcessError, e: + logging.critical("failed to delete user %s" % e) + if __name__ == "__main__": installutils.standard_logging_setup("install.log", False) cs = CADSInstance() |