Prevent server and domain from being undefined or blank when we need them

Improve LDAP error reporting
Don't return the str() of discovery values because it can return "None"

436130
This commit is contained in:
Rob Crittenden
2008-03-05 16:33:12 -05:00
parent d7e30fa7ee
commit 7fd656477a
2 changed files with 19 additions and 11 deletions

View File

@@ -77,12 +77,11 @@ def main():
ds = ipaclient.ipadiscovery.IPADiscovery()
ret = ds.search(domain=options.domain, server=options.server)
srv = ""
if ret == -10:
print "Can't get the fully qualified name of this host"
print "Please check that the client is properly configured"
return ret
if ret == -1:
if ret == -1 or not ds.getDomainName():
logging.debug("Domain not found")
if options.domain:
dom = options.domain
@@ -94,7 +93,8 @@ def main():
while dom == "":
dom = raw_input("Please provide your domain name (ex: example.com): ")
ret = ds.search(domain=dom)
if ret == -2:
dom = ds.getDomainName()
if ret == -2 or not ds.getServerName():
dnsok = False
logging.debug("IPA Server not found")
if options.server:
@@ -103,11 +103,15 @@ def main():
return ret
else:
print "Failed to find the IPA Server (DNS misconfigured?)"
srv = ""
while srv == "":
srv = raw_input("Please provide your server name (ex: ipa.example.com): ")
ret = ds.search(domain=dom, server=srv)
srv = ds.getServerName()
if ret != 0:
print "Failed to verify that "+srv+" is an IPA Server, aborting!"
print "Failed to verify that "+srv+" is an IPA Server."
print "This may mean that the remote server is not up or is not reachable"
print "due to network or firewall settings."
return ret
if dnsok: