pgreco / rpms / ipa

Forked from forks/areguera/rpms/ipa 4 years ago
Clone

Blame SOURCES/0182-ipa-ca-install-print-more-specific-errors-when-CA-is.patch

aa60fb
From 3d13e08deee3586635e583c1d5ac8c722530ac2f Mon Sep 17 00:00:00 2001
aa60fb
From: Martin Babinsky <mbabinsk@redhat.com>
aa60fb
Date: Wed, 15 Jul 2015 14:15:49 +0200
aa60fb
Subject: [PATCH] ipa-ca-install: print more specific errors when CA is already
aa60fb
 installed
aa60fb
aa60fb
This patch implements a more thorough checking for already installed CAs
aa60fb
during standalone CA installation using ipa-ca-install. The installer now
aa60fb
differentiates between CA that is already installed locally and CA installed
aa60fb
on one or more masters in topology and prints an appropriate error message.
aa60fb
aa60fb
https://fedorahosted.org/freeipa/ticket/4492
aa60fb
aa60fb
Reviewed-By: Martin Basti <mbasti@redhat.com>
aa60fb
---
aa60fb
 ipaserver/install/ca.py | 12 ++++++++++--
aa60fb
 1 file changed, 10 insertions(+), 2 deletions(-)
aa60fb
aa60fb
diff --git a/ipaserver/install/ca.py b/ipaserver/install/ca.py
aa60fb
index 0de992cb0c15f8161aae4937699baae2a94d305a..84cbf423246534259cd6b7a8cca25caa16e5594f 100644
aa60fb
--- a/ipaserver/install/ca.py
aa60fb
+++ b/ipaserver/install/ca.py
aa60fb
@@ -45,8 +45,16 @@ def install_check(standalone, replica_config, options):
aa60fb
 
aa60fb
         return
aa60fb
 
aa60fb
-    if standalone and api.Command.ca_is_enabled()['result']:
aa60fb
-        sys.exit("CA is already installed.\n")
aa60fb
+    if standalone:
aa60fb
+        if cainstance.is_ca_installed_locally():
aa60fb
+            sys.exit("CA is already installed on this host.")
aa60fb
+        elif api.Command.ca_is_enabled()['result']:
aa60fb
+            sys.exit(
aa60fb
+                "One or more CA masters are already present in IPA realm "
aa60fb
+                "'%s'.\nIf you wish to replicate CA to this host, please "
aa60fb
+                "re-run 'ipa-ca-install'\nwith a replica file generated on "
aa60fb
+                "an existing CA master as argument." % realm_name
aa60fb
+            )
aa60fb
 
aa60fb
     if options.external_cert_files:
aa60fb
         if not cainstance.is_step_one_done():
aa60fb
-- 
aa60fb
2.5.0
aa60fb