On 26.9.2011 10:59, Martin Kosek wrote:
On Mon, 2011-09-12 at 09:50 +0200, Jan Cholasta wrote:
On 7.9.2011 15:13, Rob Crittenden wrote:
Jan Cholasta wrote:
On 6.9.2011 19:49, Rob Crittenden wrote:
Jan Cholasta wrote:
https://fedorahosted.org/freeipa/ticket/1717

Honza

nack, what if there are multiple interfaces and you want IPA to use one
(that doesn't happen to be the system hostname one)?

rob

Then the user configures the system hostname to match the hostname of
the interface. Or should we configure it automatically from the install?

Honza


We can't dictate which interface matches the hostname. At most we can
warn about this, but not fail to install.

rob

Changed to print a warning message instead of raising an error.

Honza


With this patch, ipa-replica-prepare always reports the warning:

# ipa-replica-prepare vm-050.idm.lab.bos.redhat.com
Warning: The host name 'vm-050.idm.lab.bos.redhat.com' does not match the 
system host name 'vm-134.idm.lab.bos.redhat.com'.
          Some services may not work properly.
Directory Manager (existing master) password:

Reopening 1717.

Martin


Fixed. Patch attached.

Honza

--
Jan Cholasta
>From 8eb11a09b27d1abfc6d39353a4fa4e38140bf7b0 Mon Sep 17 00:00:00 2001
From: Jan Cholasta <jchol...@redhat.com>
Date: Mon, 26 Sep 2011 11:34:16 +0200
Subject: [PATCH] Fix ipa-replica-prepare always warning the user about not
 using the system hostname.

ticket 1717
---
 install/tools/ipa-replica-prepare |    2 +-
 ipaserver/install/installutils.py |   11 ++++++-----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/install/tools/ipa-replica-prepare b/install/tools/ipa-replica-prepare
index c360190..efc6de5 100755
--- a/install/tools/ipa-replica-prepare
+++ b/install/tools/ipa-replica-prepare
@@ -244,7 +244,7 @@ def main():
         options.setup_pkinit = False
 
     try:
-        installutils.verify_fqdn(replica_fqdn)
+        installutils.verify_fqdn(replica_fqdn, no_system_hostname=True)
     except RuntimeError, e:
         msg = str(e)
         if msg.startswith('Unable to resolve host name'):
diff --git a/ipaserver/install/installutils.py b/ipaserver/install/installutils.py
index d9b391f..809924e 100644
--- a/ipaserver/install/installutils.py
+++ b/ipaserver/install/installutils.py
@@ -117,7 +117,7 @@ def verify_dns_records(host_name, responses, resaddr, family):
         raise RuntimeError("The DNS forward record %s does not match the reverse address %s" % (rec.dns_name, rev.rdata.ptrdname))
 
 
-def verify_fqdn(host_name,no_host_dns=False):
+def verify_fqdn(host_name, no_host_dns=False, no_system_hostname=False):
     if len(host_name.split(".")) < 2 or host_name == "localhost.localdomain":
         raise RuntimeError("Invalid hostname '%s', must be fully-qualified." % host_name)
 
@@ -127,10 +127,11 @@ def verify_fqdn(host_name,no_host_dns=False):
     if ipautil.valid_ip(host_name):
         raise RuntimeError("IP address not allowed as a hostname")
 
-    system_host_name = socket.gethostname()
-    if not (host_name + '.').startswith(system_host_name + '.'):
-        print "Warning: The host name '%s' does not match the system host name '%s'." % (host_name, system_host_name)
-        print "         Some services may not work properly."
+    if not no_system_hostname:
+        system_host_name = socket.gethostname()
+        if not (host_name + '.').startswith(system_host_name + '.'):
+            print "Warning: The host name '%s' does not match the system host name '%s'." % (host_name, system_host_name)
+            print "         Some services may not work properly."
 
     if no_host_dns:
         print "Warning: skipping DNS resolution of host", host_name
-- 
1.7.6.2

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to