summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Kosek <mkosek@redhat.com>2011-10-12 10:55:08 +0200
committerRob Crittenden <rcritten@redhat.com>2011-10-12 00:50:33 -0400
commit7227ffe86485bcfc9d97ce302120cfae56541a03 (patch)
tree6f9ff264326e2260c919e87966fa13fbdc58ca98
parent3608f85fcbab9c9dd3795508d277faaab5b4886b (diff)
downloadfreeipa-7227ffe86485bcfc9d97ce302120cfae56541a03.tar.gz
freeipa-7227ffe86485bcfc9d97ce302120cfae56541a03.tar.xz
freeipa-7227ffe86485bcfc9d97ce302120cfae56541a03.zip
ipa-client-install hangs if the discovered server is unresponsive
Add a timeout to the wget call to cover a case when autodiscovered server does not response to our attempt to download ca.crt. Let user specify a different IPA server in that case. https://fedorahosted.org/freeipa/ticket/1960
-rwxr-xr-xipa-client/ipa-install/ipa-client-install6
-rw-r--r--ipa-client/ipaclient/ipadiscovery.py3
2 files changed, 6 insertions, 3 deletions
diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install
index f074d5d2d..e1487fae0 100755
--- a/ipa-client/ipa-install/ipa-client-install
+++ b/ipa-client/ipa-install/ipa-client-install
@@ -797,7 +797,8 @@ def install(options, env, fstore, statestore):
if ret == ipadiscovery.NOT_FQDN:
print >>sys.stderr, "%s is not a fully-qualified hostname" % hostname
return CLIENT_INSTALL_ERROR
- if ret == ipadiscovery.NO_LDAP_SERVER or not ds.getDomainName():
+ if ret in (ipadiscovery.NO_LDAP_SERVER, ipadiscovery.NOT_IPA_SERVER) \
+ or not ds.getDomainName():
logging.debug("Domain not found")
if options.domain:
cli_domain = options.domain
@@ -815,7 +816,8 @@ def install(options, env, fstore, statestore):
cli_domain = ds.getDomainName()
logging.debug("will use domain: %s\n", cli_domain)
- if ret == ipadiscovery.NO_LDAP_SERVER or not ds.getServerName():
+ if ret in (ipadiscovery.NO_LDAP_SERVER, ipadiscovery.NOT_IPA_SERVER) \
+ or not ds.getServerName():
logging.debug("IPA Server not found")
if options.server:
cli_server = options.server
diff --git a/ipa-client/ipaclient/ipadiscovery.py b/ipa-client/ipaclient/ipadiscovery.py
index cd5f81bd5..e786e98d8 100644
--- a/ipa-client/ipaclient/ipadiscovery.py
+++ b/ipa-client/ipaclient/ipadiscovery.py
@@ -220,7 +220,8 @@ class IPADiscovery:
raise RuntimeError("Creating temporary directory failed: %s" % str(e))
try:
- run(["/usr/bin/wget", "-O", "%s/ca.crt" % temp_ca_dir, "http://%s/ipa/config/ca.crt" % format_netloc(thost)])
+ run(["/usr/bin/wget", "-O", "%s/ca.crt" % temp_ca_dir, "-T", "15", "-t", "2",
+ "http://%s/ipa/config/ca.crt" % format_netloc(thost)])
except CalledProcessError, e:
logging.debug('Retrieving CA from %s failed.\n%s' % (thost, str(e)))
return [NOT_IPA_SERVER]