From 53294aa7a7db7eff527455fc35283306b37fc777 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Fri, 23 Oct 2015 11:21:01 -0400 Subject: [PATCH] Check early if a CA is already installed locally There is no reason to proceed if a CA is already installed, and the check does not involve a lot of setup, so do it early on. Ticket: https://fedorahosted.org/freeipa/ticket/5397 Signed-off-by: Simo Sorce Reviewed-By: Martin Basti --- install/tools/ipa-ca-install | 3 +++ ipaserver/install/ca.py | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/install/tools/ipa-ca-install b/install/tools/ipa-ca-install index 7f4c62176..4c778d950 100755 --- a/install/tools/ipa-ca-install +++ b/install/tools/ipa-ca-install @@ -231,6 +231,9 @@ def main(): if not dsinstance.DsInstance().is_configured(): sys.exit("IPA server is not configured on this system.\n") + if cainstance.is_ca_installed_locally(): + sys.exit("CA is already installed on this host.") + standard_logging_setup(paths.IPASERVER_CA_INSTALL_LOG, debug=options.debug) root_logger.debug("%s was invoked with options: %s,%s", sys.argv[0], safe_options, filename) diff --git a/ipaserver/install/ca.py b/ipaserver/install/ca.py index 303a9da6f..8d0252cbb 100644 --- a/ipaserver/install/ca.py +++ b/ipaserver/install/ca.py @@ -52,9 +52,7 @@ def install_check(standalone, replica_config, options): return if standalone: - if cainstance.is_ca_installed_locally(): - sys.exit("CA is already installed on this host.") - elif api.Command.ca_is_enabled()['result']: + if api.Command.ca_is_enabled()['result']: sys.exit( "One or more CA masters are already present in IPA realm " "'%s'.\nIf you wish to replicate CA to this host, please "