summaryrefslogtreecommitdiffstats
path: root/install/tools
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2011-01-10 17:16:25 -0500
committerRob Crittenden <rcritten@redhat.com>2011-01-11 10:22:33 -0500
commit06179dc105239496a7b0e55fc4a19ce576033565 (patch)
treefff1f4a85780dbfe10082a4e32df58e82b79432c /install/tools
parent371ce528fb75b9e10b197a469425fef42be59051 (diff)
downloadfreeipa-06179dc105239496a7b0e55fc4a19ce576033565.tar.gz
freeipa-06179dc105239496a7b0e55fc4a19ce576033565.tar.xz
freeipa-06179dc105239496a7b0e55fc4a19ce576033565.zip
Exit if a DNS A or AAAA record doesn't exist for the replica we are preparing.
Without this it is possible to prepare a replica for a host that doesn't exist in DNS. The result when this replica file is installed is that replication will fail because the master won't be able to communicate to the replica by name. ticket 680
Diffstat (limited to 'install/tools')
-rwxr-xr-xinstall/tools/ipa-replica-prepare22
1 files changed, 22 insertions, 0 deletions
diff --git a/install/tools/ipa-replica-prepare b/install/tools/ipa-replica-prepare
index 0c3388de..908c50a1 100755
--- a/install/tools/ipa-replica-prepare
+++ b/install/tools/ipa-replica-prepare
@@ -245,6 +245,22 @@ def main():
if not options.pkinit_pkcs12 and not certs.ipa_self_signed():
options.setup_pkinit = False
+ try:
+ installutils.verify_fqdn(replica_fqdn)
+ except RuntimeError, e:
+ msg = str(e)
+ if msg.startswith('Unable to resolve host name'):
+ if options.ip_address is None:
+ if bindinstance.dns_container_exists(api.env.host,
+ api.env.basedn):
+ msg += '\nAdd the --ip-address argument to create a DNS entry.'
+ sys.exit(msg)
+ else:
+ # The host doesn't exist in DNS but we're adding it.
+ pass
+ else:
+ sys.exit(msg)
+
if options.ip_address:
if not bindinstance.dns_container_exists(api.env.host, api.env.basedn):
print "You can't add a DNS record because DNS is not set up."
@@ -255,6 +271,12 @@ def main():
check_ipa_configuration(api.env.realm)
+ if not options.ip_address:
+ try:
+ api.Command['dns_resolve'](replica_fqdn)
+ except errors.NotFound:
+ sys.exit("Neither an A nor AAAA record for host '%s' does not exist in DNS.\nUse the --ip-address option to add DNS entries for the replica." % replica_fqdn)
+
if api.env.host == replica_fqdn:
print "You can't create a replica on itself"
sys.exit(1)