590d18
From dc32238b191a84f0677e2d3ae47f5b319946faf9 Mon Sep 17 00:00:00 2001
590d18
From: Martin Basti <mbasti@redhat.com>
590d18
Date: Tue, 18 Aug 2015 18:01:09 +0200
590d18
Subject: [PATCH] Server Upgrade: Start DS before CA is started.
590d18
590d18
https://fedorahosted.org/freeipa/ticket/5232
590d18
590d18
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
590d18
---
590d18
 ipaserver/install/server/upgrade.py | 14 ++++++++++++--
590d18
 1 file changed, 12 insertions(+), 2 deletions(-)
590d18
590d18
diff --git a/ipaserver/install/server/upgrade.py b/ipaserver/install/server/upgrade.py
590d18
index 692d0c77e0683f4ad35ebbc14d5a34decc098deb..a57682a4bbdaab2a15b4e415223e2f5faa67ba73 100644
590d18
--- a/ipaserver/install/server/upgrade.py
590d18
+++ b/ipaserver/install/server/upgrade.py
590d18
@@ -1328,6 +1328,13 @@ def upgrade_configuration():
590d18
         raise RuntimeError("ipa-rewrite.conf doesn't exists (is this server?)")
590d18
 
590d18
     # Ok, we are an IPA server, do the additional tests
590d18
+    ds_serverid = installutils.realm_to_serverid(api.env.realm)
590d18
+    ds = dsinstance.DsInstance()
590d18
+
590d18
+    # start DS, CA will not start without running DS, and cause error
590d18
+    ds_running = ds.is_running()
590d18
+    if not ds_running:
590d18
+        ds.start(ds_serverid)
590d18
 
590d18
     check_certs()
590d18
 
590d18
@@ -1359,7 +1366,6 @@ def upgrade_configuration():
590d18
                     'ca.crl.MasterCRL.enableCRLUpdates', '=')
590d18
             sub_dict['CLONE']='#' if crl.lower() == 'true' else ''
590d18
 
590d18
-        ds_serverid = installutils.realm_to_serverid(api.env.realm)
590d18
         ds_dirname = dsinstance.config_dirname(ds_serverid)
590d18
 
590d18
         upgrade_file(sub_dict, paths.HTTPD_IPA_CONF,
590d18
@@ -1396,7 +1402,6 @@ def upgrade_configuration():
590d18
     http.change_mod_nss_port_from_http()
590d18
     http.configure_certmonger_renewal_guard()
590d18
 
590d18
-    ds = dsinstance.DsInstance()
590d18
     ds.configure_dirsrv_ccache()
590d18
 
590d18
     # ldap2 connection is not valid after DS restart, close connection otherwise
590d18
@@ -1526,6 +1531,11 @@ def upgrade_configuration():
590d18
 
590d18
     set_sssd_domain_option('ipa_server_mode', 'True')
590d18
 
590d18
+    if ds_running and not ds.is_running():
590d18
+        ds.start(ds_serverid)
590d18
+    elif not ds_running and ds.is_running():
590d18
+        ds.stop(ds_serverid)
590d18
+
590d18
 
590d18
 def upgrade_check(options):
590d18
     try:
590d18
-- 
590d18
2.4.3
590d18