summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2010-09-29 14:51:35 -0400
committerRob Crittenden <rcritten@redhat.com>2010-10-08 10:11:49 -0400
commit71a032db19fcebfeb5f258f6855987749e3a4e21 (patch)
tree0c8670afeda14e7cb0ba9f1cfcf9a9db4914274b
parent90e716460e2e1acf95a74370d5e4dfd9f9138bcf (diff)
downloadfreeipa-71a032db19fcebfeb5f258f6855987749e3a4e21.tar.gz
freeipa-71a032db19fcebfeb5f258f6855987749e3a4e21.tar.xz
freeipa-71a032db19fcebfeb5f258f6855987749e3a4e21.zip
Detect if DNS is already configured in IPA, or if IPA is not yet installed.
ipa-dns-manage could fail in very odd ways depending on the current configuration of the server. Handle things a bit better. ticket 210
-rwxr-xr-xinstall/tools/ipa-dns-install5
-rw-r--r--ipaserver/install/bindinstance.py7
2 files changed, 10 insertions, 2 deletions
diff --git a/install/tools/ipa-dns-install b/install/tools/ipa-dns-install
index 8fc503e4..ece77ec7 100755
--- a/install/tools/ipa-dns-install
+++ b/install/tools/ipa-dns-install
@@ -110,6 +110,9 @@ def main():
api.bootstrap(**cfg)
api.finalize()
+ if bindinstance.dns_container_exists(api.env.host, api.env.realm):
+ sys.exit("\nDNS is already configured in this IPA server.")
+
# Check we have a public IP that is associated with the hostname
if options.ip_address:
ip_address = options.ip_address
@@ -176,6 +179,8 @@ except SystemExit, e:
sys.exit(e)
except KeyboardInterrupt:
print "Installation cancelled."
+except RuntimeError, e:
+ print str(e)
except Exception, e:
message = "Unexpected error - see ipaserver-install.log for details:\n %s" % str(e)
print message
diff --git a/ipaserver/install/bindinstance.py b/ipaserver/install/bindinstance.py
index a6b49003..4e63e7e3 100644
--- a/ipaserver/install/bindinstance.py
+++ b/ipaserver/install/bindinstance.py
@@ -74,8 +74,11 @@ def dns_container_exists(fqdn, realm):
else:
return True
- server = ldap.initialize("ldap://" + fqdn)
- server.simple_bind_s()
+ try:
+ server = ldap.initialize("ldap://" + fqdn)
+ server.simple_bind_s()
+ except ldap.SERVER_DOWN:
+ raise RuntimeError('LDAP server on %s is not responding. Is IPA installed?' % fqdn)
suffix = util.realm_to_suffix(realm)
ret = object_exists("cn=dns,%s" % suffix)