From bf0b74bec4dc8b75a71d9e8d1374755a81d8b1df Mon Sep 17 00:00:00 2001 From: Felipe Barreto Date: Wed, 20 Sep 2017 09:51:44 -0300 Subject: [PATCH] Checks if Dir Server is installed and running before IPA installation In cases when IPA is installed in two steps (external CA), it's necessary to check (in the second step) if Dir. Server is running before continue with the installation. If it's not, start Directory Server. https://pagure.io/freeipa/issue/6611 Reviewed-By: Fraser Tweedale --- ipaplatform/redhat/services.py | 4 ++++ ipaserver/install/server/install.py | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/ipaplatform/redhat/services.py b/ipaplatform/redhat/services.py index 546886464..8840807fd 100644 --- a/ipaplatform/redhat/services.py +++ b/ipaplatform/redhat/services.py @@ -121,6 +121,10 @@ class RedHatDirectoryService(RedHatService): return True + def is_installed(self, instance_name): + file_path = "{}/{}-{}".format(paths.ETC_DIRSRV, "slapd", instance_name) + return os.path.exists(file_path) + def restart(self, instance_name="", capture_output=True, wait=True, ldapi=False): # We need to explicitly enable instances to install proper symlinks as diff --git a/ipaserver/install/server/install.py b/ipaserver/install/server/install.py index fe41fc298..b2faf1973 100644 --- a/ipaserver/install/server/install.py +++ b/ipaserver/install/server/install.py @@ -618,6 +618,14 @@ def install_check(installer): # check addresses here, dns module is doing own check no_matching_interface_for_ip_address_warning(ip_addresses) + instance_name = "-".join(realm_name.split(".")) + dirsrv = services.knownservices.dirsrv + if (options.external_cert_files + and dirsrv.is_installed(instance_name) + and not dirsrv.is_running(instance_name)): + logger.debug('Starting Directory Server') + services.knownservices.dirsrv.start(instance_name) + if options.setup_adtrust: adtrust.install_check(False, options, api)