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)

Reviewed-By: Petr Spacek <pspacek@redhat.com>
This commit is contained in:
Patrice Duc-Jacquet
2016-05-17 10:35:42 +02:00
committed by Martin Basti
parent ad1cac1283
commit 65794fc71c

View File

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