Created
December 16, 2024 10:16
-
-
Save moreati/697f90ab5ac7252ed1add937658348ca to your computer and use it in GitHub Desktop.
Test ansible PR 84240 wrt connection timeout option
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: d12.mynet | |
connection: ssh_noisy_get_option | |
gather_facts: false | |
vars: | |
ansible_python_interpreter: python3 | |
tasks: | |
- meta: reset_connection | |
- ping: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ansible.plugins.connection.ssh import ( | |
Connection as Connection_, | |
DOCUMENTATION as DOCUMENTATION_, | |
) | |
from ansible.utils.display import Display | |
DOCUMENTATION = DOCUMENTATION_.replace( | |
' name: ssh\n', | |
' name: ssh_noisy_get_option\n', | |
) | |
display = Display() | |
class Connection(Connection_): | |
transport = 'ssh_noisy_get_option' | |
def get_option(self, option, hostvars=None): | |
result = super().get_option(option, hostvars=hostvars) | |
if option == 'timeout': | |
display.warning(f'ssh_noisy_get_option.get_option({option!r}, ...) -> {result!r}') | |
return result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[tox] | |
envlist = | |
py312-ansible{8,9,11,10.pr84240,11.pr84240,12.dev} | |
skipsdist = true | |
[testenv] | |
deps = | |
ansible8: ansible~=8.0 | |
ansible9: ansible~=9.0 | |
ansible10: ansible~=10.0 | |
ansible11: ansible~=11.0 | |
ansible10.pr84240: git+https://github.com/s-hertel/ansible.git@backport/2.17/84240 | |
ansible11.pr84240: git+https://github.com/s-hertel/ansible.git@backport/2.18/84240 | |
ansible12.dev: git+https://github.com/ansible/ansible.git@01ca9b1d0ec882f5eea7fc42ef7f7dab9ea76d19 | |
setenv = | |
ANSIBLE_CONNECTION_PLUGINS={toxinidir}/lib/connection | |
ANSIBLE_PIPELINING=true | |
ANSIBLE_STDOUT_CALLBACK=default | |
commands = | |
ansible-playbook -i d12.mynet, connection_timeout.yml |
The overwriting behaviour I saw while working on mitogen-hq/mitogen#1201 must be specific to Mitogen
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ansible/ansible#84240 fixed templated connection actions during a
meta: reset_connection
. This gist is a check that it did not introduce a new bug: overwriting the ssh connection timeout (default 10 seconds) with the task timeout (set by timeout keyword, default 0 seconds) duringmeta: reset_connection
(and possibly persisting beyond).Based on this (slightly adhoc) testing, the answer is no - connection timeout retains the correct value (10), it is not overwritten.