403b09
From 09b5f9fc0e75886917aae014c2bb0c5bd67d3c4c Mon Sep 17 00:00:00 2001
403b09
From: Petr Spacek <pspacek@redhat.com>
403b09
Date: Tue, 12 Jul 2016 17:42:40 +0200
403b09
Subject: [PATCH] server-install: Fix --hostname option to always override
403b09
 api.env values
403b09
403b09
Attempts to compare local hostname with user-provided values are error
403b09
prone as we found out in #5794. This patch removes comparison and makes
403b09
the env values deterministic.
403b09
403b09
https://fedorahosted.org/freeipa/ticket/6071
403b09
403b09
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
403b09
---
403b09
 ipaserver/install/server/install.py | 13 +++++--------
403b09
 1 file changed, 5 insertions(+), 8 deletions(-)
403b09
403b09
diff --git a/ipaserver/install/server/install.py b/ipaserver/install/server/install.py
403b09
index 65f9318201e648b30a3c13626e807ac6f3a9416d..1e925595b93ff95a98b3e6c3d0c357b1766dc1dc 100644
403b09
--- a/ipaserver/install/server/install.py
403b09
+++ b/ipaserver/install/server/install.py
403b09
@@ -560,7 +560,12 @@ def install_check(installer):
403b09
     cfg = dict(
403b09
         context='installer',
403b09
         in_server=True,
403b09
+        # make sure host name specified by user is used instead of default
403b09
+        host=host_name,
403b09
     )
403b09
+    if setup_ca:
403b09
+        # we have an IPA-integrated CA
403b09
+        cfg['ca_host'] = host_name
403b09
 
403b09
     # Create the management framework config file and finalize api
403b09
     target_fname = paths.IPA_DEFAULT_CONF
403b09
@@ -586,14 +591,6 @@ def install_check(installer):
403b09
     # Must be readable for everyone
403b09
     os.chmod(target_fname, 0o644)
403b09
 
403b09
-    system_hostname = get_fqdn()
403b09
-    if host_name != system_hostname:
403b09
-        root_logger.debug("Chosen hostname (%s) differs from system hostname "
403b09
-                          "(%s) - change it" % (host_name, system_hostname))
403b09
-        # update `api.env.ca_host` to correct hostname
403b09
-        # https://fedorahosted.org/freeipa/ticket/4936
403b09
-        api.env.ca_host = host_name
403b09
-
403b09
     api.bootstrap(**cfg)
403b09
     api.finalize()
403b09
 
403b09
-- 
403b09
2.7.4
403b09