diff options
author | Martin Basti <mbasti@redhat.com> | 2015-10-23 14:15:00 +0200 |
---|---|---|
committer | Martin Basti <mbasti@redhat.com> | 2015-10-29 14:26:26 +0100 |
commit | 4ec8df27392b4f47c03c2cded26d6695d8c38186 (patch) | |
tree | b71d3949dc6caf13c8e987a203b71bb051db5416 /ipaserver/install/ipa_kra_install.py | |
parent | cc5a659d4304873d6f89c47a11877026cd442199 (diff) | |
download | freeipa-4ec8df27392b4f47c03c2cded26d6695d8c38186.tar.gz freeipa-4ec8df27392b4f47c03c2cded26d6695d8c38186.tar.xz freeipa-4ec8df27392b4f47c03c2cded26d6695d8c38186.zip |
KRA: fix check that CA is installed
https://fedorahosted.org/freeipa/ticket/5345
Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
Diffstat (limited to 'ipaserver/install/ipa_kra_install.py')
-rw-r--r-- | ipaserver/install/ipa_kra_install.py | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/ipaserver/install/ipa_kra_install.py b/ipaserver/install/ipa_kra_install.py index 1ae361edc..add8250d4 100644 --- a/ipaserver/install/ipa_kra_install.py +++ b/ipaserver/install/ipa_kra_install.py @@ -32,6 +32,7 @@ from ipapython import dogtag from ipapython import ipautil from ipapython.dn import DN from ipaserver.install import service +from ipaserver.install import cainstance from ipaserver.install import krainstance from ipaserver.install import dsinstance from ipaserver.install import installutils @@ -134,28 +135,13 @@ class KRAInstaller(KRAInstall): " in unattended mode" ) - self.installing_replica = dogtaginstance.is_installing_replica("KRA") - self.options.promote = False - - if self.installing_replica: - domain_level = dsinstance.get_domain_level(api) - if domain_level > DOMAIN_LEVEL_0: - self.options.promote = True - return - - if not self.args: - self.option_parser.error("A replica file is required.") - if len(self.args) > 1: - self.option_parser.error("Too many arguments provided") - + if len(self.args) > 1: + self.option_parser.error("Too many arguments provided") + elif len(self.args) == 1: self.replica_file = self.args[0] if not ipautil.file_exists(self.replica_file): self.option_parser.error( "Replica file %s does not exist" % self.replica_file) - else: - if self.args: - self.option_parser.error("Too many parameters provided. " - "No replica file is required.") def ask_for_options(self): super(KRAInstaller, self).ask_for_options() @@ -170,6 +156,26 @@ class KRAInstaller(KRAInstall): def _run(self): super(KRAInstaller, self).run() + + if not cainstance.is_ca_installed_locally(): + raise RuntimeError("Dogtag CA is not installed. " + "Please install the CA first") + + # this check can be done only when CA is installed + self.installing_replica = dogtaginstance.is_installing_replica("KRA") + self.options.promote = False + + if self.installing_replica: + domain_level = dsinstance.get_domain_level(api) + if domain_level > DOMAIN_LEVEL_0: + self.options.promote = True + elif not self.args: + raise RuntimeError("A replica file is required.") + else: + if self.args: + raise RuntimeError("Too many parameters provided. " + "No replica file is required.") + print(dedent(self.INSTALLER_START_MESSAGE)) self.options.dm_password = self.options.password |