diff options
author | Michael Kuhn <michael.kuhn@informatik.uni-hamburg.de> | 2020-02-25 16:42:12 +0100 |
---|---|---|
committer | Peter Scheibel <scheibel1@llnl.gov> | 2020-02-27 10:52:52 -0800 |
commit | 7325c207941f1dbd9d7cd83f9659eb25951ac1f9 (patch) | |
tree | aee4533ee6f8fa887245a96ff722d57c384b9425 /lib | |
parent | ffb9591dc9b58b55c1f0e3a0e00d6232b0b9f3e0 (diff) | |
download | spack-7325c207941f1dbd9d7cd83f9659eb25951ac1f9.tar.gz spack-7325c207941f1dbd9d7cd83f9659eb25951ac1f9.tar.bz2 spack-7325c207941f1dbd9d7cd83f9659eb25951ac1f9.tar.xz spack-7325c207941f1dbd9d7cd83f9659eb25951ac1f9.zip |
config: Add a new option connect_timeout
connect_timeout can be used to increase the time Spack waits for the
server to answer. This can be used to work around slow connections or
servers.
Fixes #14700
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/config.py | 1 | ||||
-rw-r--r-- | lib/spack/spack/fetch_strategy.py | 8 | ||||
-rw-r--r-- | lib/spack/spack/schema/config.py | 1 |
3 files changed, 8 insertions, 2 deletions
diff --git a/lib/spack/spack/config.py b/lib/spack/spack/config.py index b1c0ad73c7..7ed47340bf 100644 --- a/lib/spack/spack/config.py +++ b/lib/spack/spack/config.py @@ -97,6 +97,7 @@ configuration_paths = ( config_defaults = { 'config': { 'debug': False, + 'connect_timeout': 10, 'verify_ssl': True, 'checksum': True, 'dirty': False, diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py index 5ae01286c4..38ed17d28e 100644 --- a/lib/spack/spack/fetch_strategy.py +++ b/lib/spack/spack/fetch_strategy.py @@ -326,11 +326,15 @@ class URLFetchStrategy(FetchStrategy): '-D', '-', # print out HTML headers '-L', # resolve 3xx redirects - # Timeout if can't establish a connection after 10 sec. - '--connect-timeout', '10', url, ] + connect_timeout = spack.config.get('config:connect_timeout') + + if connect_timeout > 0: + # Timeout if can't establish a connection after n sec. + curl_args.extend(['--connect-timeout', str(connect_timeout)]) + if not spack.config.get('config:verify_ssl'): curl_args.append('-k') diff --git a/lib/spack/spack/schema/config.py b/lib/spack/spack/schema/config.py index 1378698825..a05af2f438 100644 --- a/lib/spack/spack/schema/config.py +++ b/lib/spack/spack/schema/config.py @@ -55,6 +55,7 @@ properties = { }, 'source_cache': {'type': 'string'}, 'misc_cache': {'type': 'string'}, + 'connect_timeout': {'type': 'integer', 'minimum': 0}, 'verify_ssl': {'type': 'boolean'}, 'suppress_gpg_warnings': {'type': 'boolean'}, 'install_missing_compilers': {'type': 'boolean'}, |