summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2011-09-26 11:34:16 +0200
committerMartin Kosek <mkosek@redhat.com>2011-09-26 17:11:09 +0200
commit5cd121d6dd620d8979328c443b9809c77c71c21b (patch)
tree0c59538d8e9254a01053bb531fe4b6d4277a4093
parentf9477be9e946ec634898f50e819d363737f304fc (diff)
downloadfreeipa-5cd121d6dd620d8979328c443b9809c77c71c21b.tar.gz
freeipa-5cd121d6dd620d8979328c443b9809c77c71c21b.tar.xz
freeipa-5cd121d6dd620d8979328c443b9809c77c71c21b.zip
Fix ipa-replica-prepare always warning the user about not using the system hostname.
ticket 1717
-rwxr-xr-xinstall/tools/ipa-replica-prepare2
-rw-r--r--ipaserver/install/installutils.py20
2 files changed, 16 insertions, 6 deletions
diff --git a/install/tools/ipa-replica-prepare b/install/tools/ipa-replica-prepare
index c3601907a..16536b378 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, system_name_check=False)
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 d9b391f38..345bf06bb 100644
--- a/ipaserver/install/installutils.py
+++ b/ipaserver/install/installutils.py
@@ -117,7 +117,16 @@ 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, system_name_check=True):
+ """
+ Verify that the given host name is fully-qualified.
+
+ Raises `RuntimeError` if the host name is not fully-qualified.
+
+ :param host_name: The host name to verify.
+ :param no_host_dns: If true, skip DNS resolution of the host name.
+ :param system_name_check: If true, check if the host name matches the system host name.
+ """
if len(host_name.split(".")) < 2 or host_name == "localhost.localdomain":
raise RuntimeError("Invalid hostname '%s', must be fully-qualified." % host_name)
@@ -127,10 +136,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 system_name_check:
+ 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