https://fedorahosted.org/freeipa/ticket/2796 -- David Kupka
From 5d1e323d87aa4bf2b21ed11b062e68e56fe9d887 Mon Sep 17 00:00:00 2001 From: David Kupka <dku...@redhat.com> Date: Mon, 21 Jul 2014 15:57:18 +0200 Subject: [PATCH] Always record that pkicreate has been executed.
Record that pkicreate/pkispawn has been executed to allow cleanup even if the installation did not finish correctly. https://fedorahosted.org/freeipa/ticket/2796 --- ipaserver/install/cainstance.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ipaserver/install/cainstance.py b/ipaserver/install/cainstance.py index b13a77d5811343175288c1191991f1ee6e6b721a..03aec95710d19b0f6cdc8eb6185ab0e832b28031 100644 --- a/ipaserver/install/cainstance.py +++ b/ipaserver/install/cainstance.py @@ -602,6 +602,7 @@ class CAInstance(service.Service): 'Contents of pkispawn configuration file (%s):\n%s' % (cfg_file, ipautil.nolog_replace(f.read(), nolog))) + self.backup_state('installed', True) try: ipautil.run(args, nolog=nolog) except ipautil.CalledProcessError, e: @@ -646,6 +647,7 @@ class CAInstance(service.Service): '-redirect', 'logs=/var/log/pki-ca', '-enable_proxy' ] + self.backup_state('installed', True) ipautil.run(args, env={'PKI_HOSTNAME':self.fqdn}) def __enable(self): @@ -1320,6 +1322,8 @@ class CAInstance(service.Service): if not enabled is None and not enabled: self.disable() + # Just eat this state if it exists + installed = self.restore_state("installed") try: if self.dogtag_constants.DOGTAG_VERSION >= 10: ipautil.run([paths.PKIDESTROY, "-i", @@ -1355,9 +1359,12 @@ class CAInstance(service.Service): # remove CRL files root_logger.info("Remove old CRL files") - for f in get_crl_files(): - root_logger.debug("Remove %s", f) - installutils.remove_file(f) + try: + for f in get_crl_files(): + root_logger.debug("Remove %s", f) + installutils.remove_file(f) + except OSError, e: + root_logger.warning("Error while removing old CRL files: %s" % e) # remove CRL directory root_logger.info("Remove CRL directory") -- 1.9.3
_______________________________________________ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel