Hi everyone

Please see attached candidate patch for ticket


Thanks and regards

From b87f48165361199d140be7bea96f07390d7d500f Mon Sep 17 00:00:00 2001
From: Patrice Duc-Jacquet <patdu...@gmail.com>
Date: Tue, 17 May 2016 10:35:42 +0200
Subject: [PATCH] Incorrect message when KRA already installed

When trying to install a second time KRA, in case domain-level=0 the error lessage is not correct. It mentions :

 "ipa-kra-install: error: A replica file is required."

Note that this behavior is not observed if domain-level=1
The subject of the fix consist in checking that KRA is not already installed before going ahead in the installation process.

Tests done: I have made the following  tests in bot domain-level=0 and domain-level=1 :
 - Install KRA (check it is correctly installed),
 - Install KRA a second time (check that the correct error message is raised)
 - uninstall KRA (check that it is correctly uninstalled)
 - Install KRA again (check that it is correctly installed)
 ipaserver/install/ipa_kra_install.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ipaserver/install/ipa_kra_install.py b/ipaserver/install/ipa_kra_install.py
index 33c1072db87d0f93a9acc59a88272e56332cbc04..9cb5f0fcc45d0c6ddb68456ee0b6d9a1fb2a2de1 100644
--- a/ipaserver/install/ipa_kra_install.py
+++ b/ipaserver/install/ipa_kra_install.py
@@ -158,6 +158,11 @@ class KRAInstaller(KRAInstall):
             raise RuntimeError("Dogtag CA is not installed. "
                                "Please install the CA first")
+        # check if KRA is not already installed
+        _kra = krainstance.KRAInstance(api)
+        if _kra.is_installed():
+            raise admintool.ScriptError("KRA already installed")
         # this check can be done only when CA is installed
         self.installing_replica = dogtaginstance.is_installing_replica("KRA")
         self.options.promote = False

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

Reply via email to