diff --git a/ipaserver/install/ca.py b/ipaserver/install/ca.py index be0e732e8..c93ae1fce 100644 --- a/ipaserver/install/ca.py +++ b/ipaserver/install/ca.py @@ -169,6 +169,24 @@ def print_ca_configuration(options): def uninstall_check(options): + """IPA needs to be running so pkidestroy can unregister CA""" + ca = cainstance.CAInstance(api.env.realm) + if not ca.is_installed(): + return + + result = ipautil.run([paths.IPACTL, 'status'], + raiseonerr=False) + + if result.returncode not in [0, 4]: + try: + logger.info( + "Starting services to unregister CA from security domain") + ipautil.run([paths.IPACTL, 'start']) + except Exception: + logger.info("Re-starting IPA failed, continuing uninstall") + + +def uninstall_crl_check(options): """Check if the host is CRL generation master""" # Skip the checks if the host is not a CA instance ca = cainstance.CAInstance(api.env.realm) diff --git a/ipaserver/install/dogtaginstance.py b/ipaserver/install/dogtaginstance.py index c2c6b3f49..4967aca01 100644 --- a/ipaserver/install/dogtaginstance.py +++ b/ipaserver/install/dogtaginstance.py @@ -305,7 +305,7 @@ class DogtagInstance(service.Service): self.print_msg("Unconfiguring %s" % self.subsystem) args = [paths.PKIDESTROY, - "-i", "pki-tomcat", + "-i", "pki-tomcat", "--force", "-s", self.subsystem] # specify --log-file on PKI 11.0.0 or later diff --git a/ipaserver/install/kra.py b/ipaserver/install/kra.py index 857c5165b..59cbda812 100644 --- a/ipaserver/install/kra.py +++ b/ipaserver/install/kra.py @@ -132,6 +132,8 @@ def uninstall_check(options): if result.returncode not in [0, 4]: try: + logger.info( + "Starting services to unregister KRA from security domain") ipautil.run([paths.IPACTL, 'start']) except Exception: logger.info("Re-starting IPA failed, continuing uninstall") diff --git a/ipaserver/install/server/install.py b/ipaserver/install/server/install.py index 4e4076410..ccb958232 100644 --- a/ipaserver/install/server/install.py +++ b/ipaserver/install/server/install.py @@ -1110,6 +1110,7 @@ def uninstall_check(installer): raise ScriptError("Aborting uninstall operation.") kra.uninstall_check(options) + ca.uninstall_check(options) try: api.Backend.ldap2.connect(autobind=True) @@ -1132,7 +1133,7 @@ def uninstall_check(installer): else: dns.uninstall_check(options) - ca.uninstall_check(options) + ca.uninstall_crl_check(options) cleanup_dogtag_server_specific_data() @@ -1181,6 +1182,9 @@ def uninstall(installer): # Uninstall the KRA prior to shutting the services down so it # can un-register with the CA. kra.uninstall() + # Uninstall the CA priori to shutting the services down so it + # can unregister from the security domain + ca.uninstall() print("Shutting down all IPA services") try: @@ -1194,8 +1198,6 @@ def uninstall(installer): restore_time_sync(sstore, fstore) - ca.uninstall() - dns.uninstall() httpinstance.HTTPInstance(fstore).uninstall()