Re: [Freeipa-devel] [PATCH] Fix ipa-ca-install bug #5397

2015-10-27 Thread Martin Basti



On 23.10.2015 17:26, Simo Sorce wrote:
This patch moves the check to see if a CA is already installed locally 
early.


Simo.





ACK
Pushed to master: 53294aa7a7db7eff527455fc35283306b37fc777

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

[Freeipa-devel] [PATCH] Fix ipa-ca-install bug #5397

2015-10-23 Thread Simo Sorce
This patch moves the check to see if a CA is already installed locally 
early.


Simo.

--
Simo Sorce * Red Hat, Inc * New York
>From 899ab1fb7dc2a207594a90ecbe84900c1d79e034 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 
---
 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 9d3e9327319a6b133347b7d6f093b8eb9a149328..87e128e6ad8d2e5d6794b9d833af0968c395dc3a 100755
--- a/install/tools/ipa-ca-install
+++ b/install/tools/ipa-ca-install
@@ -230,6 +230,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 303a9da6f69d09a6337c6f4c3445a9f111a236b2..8d0252cbb3c4141c882a252a7c65f062b1cb1447 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 "
-- 
2.4.3

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code