86baa9
From 14dc08477429ff22acf36052367394a4b59089d0 Mon Sep 17 00:00:00 2001
86baa9
From: Christian Heimes <cheimes@redhat.com>
86baa9
Date: Wed, 27 Mar 2019 11:53:33 +0100
86baa9
Subject: [PATCH] replica install: acknowledge ca_host override
86baa9
86baa9
Fixup for commit c0fd5e39c726ef4dc12e87a2f9c08ebb32ed27fe. Only set
86baa9
ca_host to source master hostname if ca_host points to the local host.
86baa9
This permits users to override ca_host in /etc/ipa/default.conf when
86baa9
installing a replica.
86baa9
86baa9
Related: https://pagure.io/freeipa/issue/7744
86baa9
Signed-off-by: Christian Heimes <cheimes@redhat.com>
86baa9
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
86baa9
Reviewed-By: Tibor Dudlak <tdudlak@redhat.com>
86baa9
Reviewed-By: Tibor Dudlak <tdudlak@redhat.com>
86baa9
---
86baa9
 ipaserver/install/server/replicainstall.py | 7 ++++++-
86baa9
 1 file changed, 6 insertions(+), 1 deletion(-)
86baa9
86baa9
diff --git a/ipaserver/install/server/replicainstall.py b/ipaserver/install/server/replicainstall.py
86baa9
index 7178238bfb996f987b5e3beaebe05fa104ada089..e13b7f18c4d4df7efde50ac9cb7d2f71bfa765cc 100644
86baa9
--- a/ipaserver/install/server/replicainstall.py
86baa9
+++ b/ipaserver/install/server/replicainstall.py
86baa9
@@ -1048,7 +1048,12 @@ def promote_check(installer):
86baa9
     config.host_name = api.env.host
86baa9
     config.domain_name = api.env.domain
86baa9
     config.master_host_name = api.env.server
86baa9
-    config.ca_host_name = api.env.ca_host
86baa9
+    if not api.env.ca_host or api.env.ca_host == api.env.host:
86baa9
+        # ca_host has not been configured explicitly, prefer source master
86baa9
+        config.ca_host_name = api.env.server
86baa9
+    else:
86baa9
+        # default to ca_host from IPA config
86baa9
+        config.ca_host_name = api.env.ca_host
86baa9
     config.kra_host_name = config.ca_host_name
86baa9
     config.ca_ds_port = 389
86baa9
     config.setup_ca = options.setup_ca
86baa9
-- 
86baa9
2.20.1
86baa9