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 <simo@redhat.com>
Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
Simo Sorce 2015-10-23 11:21:01 -04:00 committed by Martin Basti
parent c38516eab7
commit 53294aa7a7
2 changed files with 4 additions and 3 deletions

View File

@ -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)

View File

@ -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 "