mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Added in an accelerate connection timeout setting
This commit is contained in:
parent
59a5ce23d9
commit
d317103371
2 changed files with 3 additions and 1 deletions
|
@ -136,6 +136,7 @@ PARAMIKO_RECORD_HOST_KEYS = get_config(p, 'paramiko_connection', 'record_ho
|
|||
ZEROMQ_PORT = get_config(p, 'fireball_connection', 'zeromq_port', 'ANSIBLE_ZEROMQ_PORT', 5099, integer=True)
|
||||
ACCELERATE_PORT = get_config(p, 'accelerate', 'accelerate_port', 'ACCELERATE_PORT', 5099, integer=True)
|
||||
ACCELERATE_TIMEOUT = int(get_config(p, 'accelerate', 'accelerate_timeout', 'ACCELERATE_TIMEOUT', 300))
|
||||
ACCELERATE_CONNECT_TIMEOUT = float(get_config(p, 'accelerate', 'accelerate_connect_timeout', 'ACCELERATE_CONNECT_TIMEOUT', 1.0))
|
||||
|
||||
DEFAULT_UNDEFINED_VAR_BEHAVIOR = get_config(p, DEFAULTS, 'error_on_undefined_vars', 'ANSIBLE_ERROR_ON_UNDEFINED_VARS', True, boolean=True)
|
||||
HOST_KEY_CHECKING = get_config(p, DEFAULTS, 'host_key_checking', 'ANSIBLE_HOST_KEY_CHECKING', True, boolean=True)
|
||||
|
|
|
@ -103,7 +103,7 @@ class Connection(object):
|
|||
# TODO: make the timeout and retries configurable?
|
||||
tries = 3
|
||||
self.conn = socket.socket()
|
||||
self.conn.settimeout(self.runner.accelerate_timeout)
|
||||
self.conn.settimeout(constants.ACCELERATE_CONNECT_TIMEOUT)
|
||||
vvvv("attempting connection to %s via the accelerated port %d" % (self.host,self.accport))
|
||||
while tries > 0:
|
||||
try:
|
||||
|
@ -116,6 +116,7 @@ class Connection(object):
|
|||
if tries == 0:
|
||||
vvv("Could not connect via the accelerated connection, exceeded # of tries")
|
||||
raise errors.AnsibleError("Failed to connect")
|
||||
self.conn.settimeout(self.runner.accelerate_timeout)
|
||||
except:
|
||||
if allow_ssh:
|
||||
vvv("Falling back to ssh to startup accelerated mode")
|
||||
|
|
Loading…
Reference in a new issue