issue #593: expose configurables for SSH keepalive and increase the default

pull/595/head
David Wilson 6 years ago
parent 823c18ec09
commit 3620fce071

@ -145,6 +145,12 @@ def _connect_ssh(spec):
'ssh_args': spec.ssh_args(), 'ssh_args': spec.ssh_args(),
'ssh_debug_level': spec.mitogen_ssh_debug_level(), 'ssh_debug_level': spec.mitogen_ssh_debug_level(),
'remote_name': get_remote_name(spec), 'remote_name': get_remote_name(spec),
'keepalive_count': (
spec.mitogen_ssh_keepalive_count() or 10
),
'keepalive_interval': (
spec.mitogen_ssh_keepalive_interval() or 30
),
} }
} }

@ -276,6 +276,18 @@ class Spec(with_metaclass(abc.ABCMeta, object)):
The path to the "machinectl" program for the 'setns' transport. The path to the "machinectl" program for the 'setns' transport.
""" """
@abc.abstractmethod
def mitogen_ssh_keepalive_interval(self):
"""
The SSH ServerAliveInterval.
"""
@abc.abstractmethod
def mitogen_ssh_keepalive_count(self):
"""
The SSH ServerAliveCount.
"""
@abc.abstractmethod @abc.abstractmethod
def mitogen_ssh_debug_level(self): def mitogen_ssh_debug_level(self):
""" """
@ -427,6 +439,12 @@ class PlayContextSpec(Spec):
def mitogen_lxc_info_path(self): def mitogen_lxc_info_path(self):
return self._connection.get_task_var('mitogen_lxc_info_path') return self._connection.get_task_var('mitogen_lxc_info_path')
def mitogen_ssh_keepalive_interval(self):
return self._connection.get_task_var('mitogen_ssh_keepalive_interval')
def mitogen_ssh_keepalive_count(self):
return self._connection.get_task_var('mitogen_ssh_keepalive_count')
def mitogen_machinectl_path(self): def mitogen_machinectl_path(self):
return self._connection.get_task_var('mitogen_machinectl_path') return self._connection.get_task_var('mitogen_machinectl_path')
@ -644,6 +662,12 @@ class MitogenViaSpec(Spec):
def mitogen_lxc_info_path(self): def mitogen_lxc_info_path(self):
return self._host_vars.get('mitogen_lxc_info_path') return self._host_vars.get('mitogen_lxc_info_path')
def mitogen_ssh_keepalive_interval(self):
return self._host_vars.get('mitogen_ssh_keepalive_interval')
def mitogen_ssh_keepalive_count(self):
return self._host_vars.get('mitogen_ssh_keepalive_count')
def mitogen_machinectl_path(self): def mitogen_machinectl_path(self):
return self._host_vars.get('mitogen_machinectl_path') return self._host_vars.get('mitogen_machinectl_path')

@ -1007,6 +1007,11 @@ except connection delegation is supported.
otherwise :data:`False`. This will change to off by default in a future otherwise :data:`False`. This will change to off by default in a future
release. If you are targetting many hosts on a fast network, please consider release. If you are targetting many hosts on a fast network, please consider
disabling SSH compression. disabling SSH compression.
* ``mitogen_ssh_keepalive_count``: integer count of server keepalive messages to
which no reply is received before considering the SSH server dead. Defaults
to 10.
* ``mitogen_ssh_keepalive_count``: integer seconds delay between keepalive
messages. Defaults to 30.
Debugging Debugging

@ -45,6 +45,11 @@ Fixes
:func:`os.getcwd` prior to :class:`AnsibleModule` initialization, such as the :func:`os.getcwd` prior to :class:`AnsibleModule` initialization, such as the
Ansible 2.7 ``pip`` module, cannot fail due to the behavior of a prior task. Ansible 2.7 ``pip`` module, cannot fail due to the behavior of a prior task.
* `#593 <https://github.com/dw/mitogen/issues/593>`_: the SSH connection method
exposes ``mitogen_ssh_keepalive_interval`` and
``mitogen_ssh_keepalive_count`` variables, and the default timeout for an SSH
server has been increased from `15*3` seconds to `30*10` seconds.
Thanks! Thanks!
~~~~~~~ ~~~~~~~
@ -53,8 +58,9 @@ Mitogen would not be possible without the support of users. A huge thanks for
bug reports, testing, features and fixes in this release contributed by bug reports, testing, features and fixes in this release contributed by
`Anton Markelov <https://github.com/strangeman>`_, `Anton Markelov <https://github.com/strangeman>`_,
`Nigel Metheringham <https://github.com/nigelm>`_, `Nigel Metheringham <https://github.com/nigelm>`_,
`Orion Poplawski <https://github.com/opoplawski>`_, and `Orion Poplawski <https://github.com/opoplawski>`_,
`Ulrich Schreiner <https://github.com/ulrichSchreiner>`_. `Ulrich Schreiner <https://github.com/ulrichSchreiner>`_, and
`Yuki Nishida <https://github.com/yuki-nishida-exa>`_.
v0.2.7 (2019-05-19) v0.2.7 (2019-05-19)

@ -37,6 +37,8 @@
'hostname': 'alias-host', 'hostname': 'alias-host',
'identities_only': False, 'identities_only': False,
'identity_file': null, 'identity_file': null,
'keepalive_interval': 30,
'keepalive_count': 10,
'password': null, 'password': null,
'port': null, 'port': null,
'python_path': ["/usr/bin/python"], 'python_path': ["/usr/bin/python"],
@ -65,6 +67,8 @@
'hostname': 'cd-normal-alias', 'hostname': 'cd-normal-alias',
'identities_only': False, 'identities_only': False,
'identity_file': null, 'identity_file': null,
'keepalive_interval': 30,
'keepalive_count': 10,
'password': null, 'password': null,
'port': null, 'port': null,
'python_path': ["/usr/bin/python"], 'python_path': ["/usr/bin/python"],

@ -71,6 +71,8 @@
'hostname': 'alias-host', 'hostname': 'alias-host',
'identities_only': False, 'identities_only': False,
'identity_file': null, 'identity_file': null,
'keepalive_interval': 30,
'keepalive_count': 10,
'password': null, 'password': null,
'port': null, 'port': null,
"python_path": ["/usr/bin/python"], "python_path": ["/usr/bin/python"],
@ -112,6 +114,8 @@
'hostname': 'alias-host', 'hostname': 'alias-host',
'identities_only': False, 'identities_only': False,
'identity_file': null, 'identity_file': null,
'keepalive_interval': 30,
'keepalive_count': 10,
'password': null, 'password': null,
'port': null, 'port': null,
"python_path": ["/usr/bin/python"], "python_path": ["/usr/bin/python"],
@ -164,6 +168,8 @@
'hostname': 'cd-normal-normal', 'hostname': 'cd-normal-normal',
'identities_only': False, 'identities_only': False,
'identity_file': null, 'identity_file': null,
'keepalive_interval': 30,
'keepalive_count': 10,
'password': null, 'password': null,
'port': null, 'port': null,
"python_path": ["/usr/bin/python"], "python_path": ["/usr/bin/python"],
@ -205,6 +211,8 @@
'hostname': 'alias-host', 'hostname': 'alias-host',
'identities_only': False, 'identities_only': False,
'identity_file': null, 'identity_file': null,
'keepalive_interval': 30,
'keepalive_count': 10,
'password': null, 'password': null,
'port': null, 'port': null,
"python_path": ["/usr/bin/python"], "python_path": ["/usr/bin/python"],
@ -233,6 +241,8 @@
'hostname': 'cd-normal-alias', 'hostname': 'cd-normal-alias',
'identities_only': False, 'identities_only': False,
'identity_file': null, 'identity_file': null,
'keepalive_interval': 30,
'keepalive_count': 10,
'password': null, 'password': null,
'port': null, 'port': null,
"python_path": ["/usr/bin/python"], "python_path": ["/usr/bin/python"],
@ -285,6 +295,8 @@
'hostname': 'cd-newuser-normal-normal', 'hostname': 'cd-newuser-normal-normal',
'identities_only': False, 'identities_only': False,
'identity_file': null, 'identity_file': null,
'keepalive_interval': 30,
'keepalive_count': 10,
'password': null, 'password': null,
'port': null, 'port': null,
"python_path": ["/usr/bin/python"], "python_path": ["/usr/bin/python"],
@ -327,6 +339,8 @@
'hostname': 'alias-host', 'hostname': 'alias-host',
'identities_only': False, 'identities_only': False,
'identity_file': null, 'identity_file': null,
'keepalive_interval': 30,
'keepalive_count': 10,
'password': null, 'password': null,
'port': null, 'port': null,
"python_path": ["/usr/bin/python"], "python_path": ["/usr/bin/python"],

Loading…
Cancel
Save