Merge pull request #1006 from moreati/test-on-22.04

tests: Support Ubuntu 22.04 as test suite runner (controller)
pull/1019/head
Alex Willmer 1 year ago committed by GitHub
commit 88f15a8169
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -48,5 +48,21 @@ host_pattern_mismatch = error
task_output_limit = 10 task_output_limit = 10
[ssh_connection] [ssh_connection]
ssh_args = -o UserKnownHostsFile=/dev/null -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s # https://www.openssh.com/legacy.html
# ssh-rsa uses SHA1. Least worst available with CentOS 7 sshd.
# Rejected by default in newer ssh clients (e.g. Ubuntu 22.04).
# Duplicated cases in
# - tests/ansible/ansible.cfg
# - tests/ansible/integration/connection_delegation/delegate_to_template.yml
# - tests/ansible/integration/connection_delegation/stack_construction.yml
# - tests/ansible/integration/process/unix_socket_cleanup.yml
# - tests/ansible/integration/ssh/variables.yml
# - tests/testlib.py
ssh_args =
-o ControlMaster=auto
-o ControlPersist=60s
-o ForwardAgent=yes
-o HostKeyAlgorithms=+ssh-rsa
-o PubkeyAcceptedKeyTypes=+ssh-rsa
-o UserKnownHostsFile=/dev/null
pipelining = True pipelining = True

@ -44,14 +44,12 @@
'python_path': ["/usr/bin/python"], 'python_path': ["/usr/bin/python"],
'remote_name': null, 'remote_name': null,
'ssh_args': [ 'ssh_args': [
'-o', -o, ControlMaster=auto,
'UserKnownHostsFile=/dev/null', -o, ControlPersist=60s,
'-o', -o, ForwardAgent=yes,
'ForwardAgent=yes', -o, HostKeyAlgorithms=+ssh-rsa,
'-o', -o, PubkeyAcceptedKeyTypes=+ssh-rsa,
'ControlMaster=auto', -o, UserKnownHostsFile=/dev/null,
'-o',
'ControlPersist=60s',
], ],
'ssh_debug_level': null, 'ssh_debug_level': null,
'ssh_path': 'ssh', 'ssh_path': 'ssh',
@ -74,14 +72,12 @@
'python_path': ["/usr/bin/python"], 'python_path': ["/usr/bin/python"],
'remote_name': null, 'remote_name': null,
'ssh_args': [ 'ssh_args': [
'-o', -o, ControlMaster=auto,
'UserKnownHostsFile=/dev/null', -o, ControlPersist=60s,
'-o', -o, ForwardAgent=yes,
'ForwardAgent=yes', -o, HostKeyAlgorithms=+ssh-rsa,
'-o', -o, PubkeyAcceptedKeyTypes=+ssh-rsa,
'ControlMaster=auto', -o, UserKnownHostsFile=/dev/null,
'-o',
'ControlPersist=60s',
], ],
'ssh_debug_level': null, 'ssh_debug_level': null,
'ssh_path': 'ssh', 'ssh_path': 'ssh',

@ -81,14 +81,12 @@
"python_path": ["/usr/bin/python"], "python_path": ["/usr/bin/python"],
'remote_name': null, 'remote_name': null,
'ssh_args': [ 'ssh_args': [
'-o', -o, ControlMaster=auto,
'UserKnownHostsFile=/dev/null', -o, ControlPersist=60s,
'-o', -o, ForwardAgent=yes,
'ForwardAgent=yes', -o, HostKeyAlgorithms=+ssh-rsa,
'-o', -o, PubkeyAcceptedKeyTypes=+ssh-rsa,
'ControlMaster=auto', -o, UserKnownHostsFile=/dev/null,
'-o',
'ControlPersist=60s',
], ],
'ssh_debug_level': null, 'ssh_debug_level': null,
'ssh_path': 'ssh', 'ssh_path': 'ssh',
@ -126,14 +124,12 @@
"python_path": ["/usr/bin/python"], "python_path": ["/usr/bin/python"],
'remote_name': null, 'remote_name': null,
'ssh_args': [ 'ssh_args': [
'-o', -o, ControlMaster=auto,
'UserKnownHostsFile=/dev/null', -o, ControlPersist=60s,
'-o', -o, ForwardAgent=yes,
'ForwardAgent=yes', -o, HostKeyAlgorithms=+ssh-rsa,
'-o', -o, PubkeyAcceptedKeyTypes=+ssh-rsa,
'ControlMaster=auto', -o, UserKnownHostsFile=/dev/null,
'-o',
'ControlPersist=60s',
], ],
'ssh_debug_level': null, 'ssh_debug_level': null,
'ssh_path': 'ssh', 'ssh_path': 'ssh',
@ -182,14 +178,12 @@
"python_path": ["/usr/bin/python"], "python_path": ["/usr/bin/python"],
'remote_name': null, 'remote_name': null,
'ssh_args': [ 'ssh_args': [
'-o', -o, ControlMaster=auto,
'UserKnownHostsFile=/dev/null', -o, ControlPersist=60s,
'-o', -o, ForwardAgent=yes,
'ForwardAgent=yes', -o, HostKeyAlgorithms=+ssh-rsa,
'-o', -o, PubkeyAcceptedKeyTypes=+ssh-rsa,
'ControlMaster=auto', -o, UserKnownHostsFile=/dev/null,
'-o',
'ControlPersist=60s',
], ],
'ssh_debug_level': null, 'ssh_debug_level': null,
'ssh_path': 'ssh', 'ssh_path': 'ssh',
@ -227,14 +221,12 @@
"python_path": ["/usr/bin/python"], "python_path": ["/usr/bin/python"],
'remote_name': null, 'remote_name': null,
'ssh_args': [ 'ssh_args': [
'-o', -o, ControlMaster=auto,
'UserKnownHostsFile=/dev/null', -o, ControlPersist=60s,
'-o', -o, ForwardAgent=yes,
'ForwardAgent=yes', -o, HostKeyAlgorithms=+ssh-rsa,
'-o', -o, PubkeyAcceptedKeyTypes=+ssh-rsa,
'ControlMaster=auto', -o, UserKnownHostsFile=/dev/null,
'-o',
'ControlPersist=60s',
], ],
'ssh_debug_level': null, 'ssh_debug_level': null,
'ssh_path': 'ssh', 'ssh_path': 'ssh',
@ -257,14 +249,12 @@
"python_path": ["/usr/bin/python"], "python_path": ["/usr/bin/python"],
'remote_name': null, 'remote_name': null,
'ssh_args': [ 'ssh_args': [
'-o', -o, ControlMaster=auto,
'UserKnownHostsFile=/dev/null', -o, ControlPersist=60s,
'-o', -o, ForwardAgent=yes,
'ForwardAgent=yes', -o, HostKeyAlgorithms=+ssh-rsa,
'-o', -o, PubkeyAcceptedKeyTypes=+ssh-rsa,
'ControlMaster=auto', -o, UserKnownHostsFile=/dev/null,
'-o',
'ControlPersist=60s',
], ],
'ssh_debug_level': null, 'ssh_debug_level': null,
'ssh_path': 'ssh', 'ssh_path': 'ssh',
@ -313,14 +303,12 @@
"python_path": ["/usr/bin/python"], "python_path": ["/usr/bin/python"],
'remote_name': null, 'remote_name': null,
'ssh_args': [ 'ssh_args': [
'-o', -o, ControlMaster=auto,
'UserKnownHostsFile=/dev/null', -o, ControlPersist=60s,
'-o', -o, ForwardAgent=yes,
'ForwardAgent=yes', -o, HostKeyAlgorithms=+ssh-rsa,
'-o', -o, PubkeyAcceptedKeyTypes=+ssh-rsa,
'ControlMaster=auto', -o, UserKnownHostsFile=/dev/null,
'-o',
'ControlPersist=60s',
], ],
'ssh_debug_level': null, 'ssh_debug_level': null,
'ssh_path': 'ssh', 'ssh_path': 'ssh',
@ -359,14 +347,12 @@
"python_path": ["/usr/bin/python"], "python_path": ["/usr/bin/python"],
'remote_name': null, 'remote_name': null,
'ssh_args': [ 'ssh_args': [
'-o', -o, ControlMaster=auto,
'UserKnownHostsFile=/dev/null', -o, ControlPersist=60s,
'-o', -o, ForwardAgent=yes,
'ForwardAgent=yes', -o, HostKeyAlgorithms=+ssh-rsa,
'-o', -o, PubkeyAcceptedKeyTypes=+ssh-rsa,
'ControlMaster=auto', -o, UserKnownHostsFile=/dev/null,
'-o',
'ControlPersist=60s',
], ],
'ssh_debug_level': null, 'ssh_debug_level': null,
'ssh_path': 'ssh', 'ssh_path': 'ssh',

@ -9,7 +9,7 @@
- shell: > - shell: >
ANSIBLE_STRATEGY=mitogen_linear ANSIBLE_STRATEGY=mitogen_linear
ANSIBLE_SSH_ARGS="" ANSIBLE_SSH_ARGS="-o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedKeyTypes=+ssh-rsa"
ansible -m shell -c local -a whoami ansible -m shell -c local -a whoami
{% for inv in ansible_inventory_sources %} {% for inv in ansible_inventory_sources %}
-i "{{ inv }}" -i "{{ inv }}"

@ -17,7 +17,7 @@
shell: > shell: >
ANSIBLE_ANY_ERRORS_FATAL=false ANSIBLE_ANY_ERRORS_FATAL=false
ANSIBLE_STRATEGY=mitogen_linear ANSIBLE_STRATEGY=mitogen_linear
ANSIBLE_SSH_ARGS="" ANSIBLE_SSH_ARGS="-o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedKeyTypes=+ssh-rsa"
ansible -m shell -a whoami ansible -m shell -a whoami
{% for inv in ansible_inventory_sources %} {% for inv in ansible_inventory_sources %}
-i "{{ inv }}" -i "{{ inv }}"
@ -34,7 +34,7 @@
shell: > shell: >
ANSIBLE_ANY_ERRORS_FATAL=false ANSIBLE_ANY_ERRORS_FATAL=false
ANSIBLE_STRATEGY=mitogen_linear ANSIBLE_STRATEGY=mitogen_linear
ANSIBLE_SSH_ARGS="" ANSIBLE_SSH_ARGS="-o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedKeyTypes=+ssh-rsa"
ansible -m shell -a whoami ansible -m shell -a whoami
{% for inv in ansible_inventory_sources %} {% for inv in ansible_inventory_sources %}
-i "{{ inv }}" -i "{{ inv }}"
@ -59,7 +59,7 @@
shell: > shell: >
ANSIBLE_ANY_ERRORS_FATAL=false ANSIBLE_ANY_ERRORS_FATAL=false
ANSIBLE_STRATEGY=mitogen_linear ANSIBLE_STRATEGY=mitogen_linear
ANSIBLE_SSH_ARGS="" ANSIBLE_SSH_ARGS="-o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedKeyTypes=+ssh-rsa"
ansible -m shell -a whoami ansible -m shell -a whoami
{% for inv in ansible_inventory_sources %} {% for inv in ansible_inventory_sources %}
-i "{{ inv }}" -i "{{ inv }}"
@ -76,7 +76,7 @@
shell: > shell: >
ANSIBLE_ANY_ERRORS_FATAL=false ANSIBLE_ANY_ERRORS_FATAL=false
ANSIBLE_STRATEGY=mitogen_linear ANSIBLE_STRATEGY=mitogen_linear
ANSIBLE_SSH_ARGS="" ANSIBLE_SSH_ARGS="-o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedKeyTypes=+ssh-rsa"
ansible -m shell -a whoami ansible -m shell -a whoami
{% for inv in ansible_inventory_sources %} {% for inv in ansible_inventory_sources %}
-i "{{ inv }}" -i "{{ inv }}"
@ -101,7 +101,7 @@
shell: > shell: >
ANSIBLE_ANY_ERRORS_FATAL=false ANSIBLE_ANY_ERRORS_FATAL=false
ANSIBLE_STRATEGY=mitogen_linear ANSIBLE_STRATEGY=mitogen_linear
ANSIBLE_SSH_ARGS="" ANSIBLE_SSH_ARGS="-o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedKeyTypes=+ssh-rsa"
ansible -m shell -a whoami ansible -m shell -a whoami
{% for inv in ansible_inventory_sources %} {% for inv in ansible_inventory_sources %}
-i "{{ inv }}" -i "{{ inv }}"
@ -118,7 +118,7 @@
shell: > shell: >
ANSIBLE_ANY_ERRORS_FATAL=false ANSIBLE_ANY_ERRORS_FATAL=false
ANSIBLE_STRATEGY=mitogen_linear ANSIBLE_STRATEGY=mitogen_linear
ANSIBLE_SSH_ARGS="" ANSIBLE_SSH_ARGS="-o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedKeyTypes=+ssh-rsa"
ansible -m shell -a whoami ansible -m shell -a whoami
{% for inv in ansible_inventory_sources %} {% for inv in ansible_inventory_sources %}
-i "{{ inv }}" -i "{{ inv }}"
@ -148,7 +148,7 @@
shell: > shell: >
ANSIBLE_ANY_ERRORS_FATAL=false ANSIBLE_ANY_ERRORS_FATAL=false
ANSIBLE_STRATEGY=mitogen_linear ANSIBLE_STRATEGY=mitogen_linear
ANSIBLE_SSH_ARGS="" ANSIBLE_SSH_ARGS="-o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedKeyTypes=+ssh-rsa"
ansible -m shell -a whoami ansible -m shell -a whoami
{% for inv in ansible_inventory_sources %} {% for inv in ansible_inventory_sources %}
-i "{{ inv }}" -i "{{ inv }}"
@ -165,7 +165,7 @@
shell: > shell: >
ANSIBLE_ANY_ERRORS_FATAL=false ANSIBLE_ANY_ERRORS_FATAL=false
ANSIBLE_STRATEGY=mitogen_linear ANSIBLE_STRATEGY=mitogen_linear
ANSIBLE_SSH_ARGS="" ANSIBLE_SSH_ARGS="-o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedKeyTypes=+ssh-rsa"
ansible -m shell -a whoami ansible -m shell -a whoami
{% for inv in ansible_inventory_sources %} {% for inv in ansible_inventory_sources %}
-i "{{ inv }}" -i "{{ inv }}"

@ -134,12 +134,13 @@ class SshTest(testlib.DockerMixin, testlib.TestCase):
def test_enforce_unknown_host_key(self): def test_enforce_unknown_host_key(self):
fp = tempfile.NamedTemporaryFile() fp = tempfile.NamedTemporaryFile()
ssh_args = self.docker_ssh_default_kwargs.get('ssh_args', [])
try: try:
e = self.assertRaises(mitogen.ssh.HostKeyError, e = self.assertRaises(mitogen.ssh.HostKeyError,
lambda: self.docker_ssh( lambda: self.docker_ssh(
username='mitogen__has_sudo_pubkey', username='mitogen__has_sudo_pubkey',
password='has_sudo_password', password='has_sudo_password',
ssh_args=['-o', 'UserKnownHostsFile ' + fp.name], ssh_args=ssh_args + ['-o', 'UserKnownHostsFile %s' % fp.name],
check_host_keys='enforce', check_host_keys='enforce',
) )
) )
@ -149,11 +150,12 @@ class SshTest(testlib.DockerMixin, testlib.TestCase):
def test_accept_enforce_host_keys(self): def test_accept_enforce_host_keys(self):
fp = tempfile.NamedTemporaryFile() fp = tempfile.NamedTemporaryFile()
ssh_args = self.docker_ssh_default_kwargs.get('ssh_args', [])
try: try:
context = self.docker_ssh( context = self.docker_ssh(
username='mitogen__has_sudo', username='mitogen__has_sudo',
password='has_sudo_password', password='has_sudo_password',
ssh_args=['-o', 'UserKnownHostsFile ' + fp.name], ssh_args=ssh_args + ['-o', 'UserKnownHostsFile %s' % fp.name],
check_host_keys='accept', check_host_keys='accept',
) )
context.shutdown(wait=True) context.shutdown(wait=True)
@ -166,7 +168,7 @@ class SshTest(testlib.DockerMixin, testlib.TestCase):
context = self.docker_ssh( context = self.docker_ssh(
username='mitogen__has_sudo', username='mitogen__has_sudo',
password='has_sudo_password', password='has_sudo_password',
ssh_args=['-o', 'UserKnownHostsFile ' + fp.name], ssh_args=ssh_args + ['-o', 'UserKnownHostsFile %s' % fp.name],
check_host_keys='enforce', check_host_keys='enforce',
) )
context.shutdown(wait=True) context.shutdown(wait=True)

@ -631,12 +631,33 @@ class DockerMixin(RouterMixin):
cls.dockerized_ssh.close() cls.dockerized_ssh.close()
super(DockerMixin, cls).tearDownClass() super(DockerMixin, cls).tearDownClass()
@property
def docker_ssh_default_kwargs(self):
return {
'hostname': self.dockerized_ssh.host,
'port': self.dockerized_ssh.port,
'check_host_keys': 'ignore',
'ssh_debug_level': 3,
# https://www.openssh.com/legacy.html
# ssh-rsa uses SHA1. Least worst available with CentOS 7 sshd.
# Rejected by default in newer ssh clients (e.g. Ubuntu 22.04).
# Duplicated cases in
# - tests/ansible/ansible.cfg
# - tests/ansible/integration/connection_delegation/delegate_to_template.yml
# - tests/ansible/integration/connection_delegation/stack_construction.yml
# - tests/ansible/integration/process/unix_socket_cleanup.yml
# - tests/ansible/integration/ssh/variables.yml
# - tests/testlib.py
'ssh_args': [
'-o', 'HostKeyAlgorithms +ssh-rsa',
'-o', 'PubkeyAcceptedKeyTypes +ssh-rsa',
],
'python_path': self.dockerized_ssh.python_path,
}
def docker_ssh(self, **kwargs): def docker_ssh(self, **kwargs):
kwargs.setdefault('hostname', self.dockerized_ssh.host) for k, v in self.docker_ssh_default_kwargs.items():
kwargs.setdefault('port', self.dockerized_ssh.port) kwargs.setdefault(k, v)
kwargs.setdefault('check_host_keys', 'ignore')
kwargs.setdefault('ssh_debug_level', 3)
kwargs.setdefault('python_path', self.dockerized_ssh.python_path)
return self.router.ssh(**kwargs) return self.router.ssh(**kwargs)
def docker_ssh_any(self, **kwargs): def docker_ssh_any(self, **kwargs):

@ -1,23 +1,20 @@
# This file is a local convenience. It is not a substitute for the full CI # This configuration drives both CI and local development.
# suite, and does not cover the full range of Python versions for Mitogen. # I use this locally on Ubuntu 22.04, with the following additions
# I use this on Ubuntu 20.04, with the following additions
# #
# sudo add-apt-repository ppa:deadsnakes/ppa # sudo add-apt-repository ppa:deadsnakes/ppa
# sudo apt update # sudo apt update
# sudo apt install python3.5 python3.6 python3.7 python3.9 tox libsasl2-dev libldap2-dev libssl-dev ssh-pass # sudo apt install awscli lib{ldap2,sasl2,ssl}-dev python2.7 python3.{6..11} python-is-python3 sshpass tox
# Last version to support each python version # Py tox virtualenv pip A cntrllr A target Jinja2 coverage psutil pytest
# # ==== ======== ========== ======== ========= ========= ========== ======== ======== =========
# Python tox virt'env pip A cntllr A target coverage # 2.4 <= 1.4 <= 1.8 <= 1.1 2.3? <= 3.7.1 <= 2.1.3
# ========== ======== ======== ======== ======== ======== ======== # 2.5 <= 1.6.1 <= 1.9.1 <= 1.3.1 ??? <= 3.7.1 <= 2.1.3 <= 2.8.7
# python2.4 1.4 1.8 1.1 2.3? # 2.6 <= 2.9.1 <= 15.2.0 <= 9.0.3 <= 2.6.20 <= 2.13 <= 2.10.3 <= 4.5.4 <= 5.9.0 <= 3.2.5
# python2.5 1.6.1 1.9.1 1.3.1 ??? # 2.7 <= 3.28 <= 20.3? <= 20 <= 2.11 <= 2.11.3 <= 5.6 <= 4.6.11
# python2.6 2.9.1 15.2.0 9.0.3 2.6.20 2.13 4.5.4 # 3.5 <= 3.28 <= 20.15 <= 20 <= 2.11 <= 2.13 <= 2.11.3 <= 5.6 <= 6.1.0
# python2.7 20.3 2.11 # 3.6 <= 3.28 <= 20.16 <= 21 <= 2.11 <= 3.0.3 <= 6.2 <= 7.0.1
# python3.5 2.11 # 3.7 <= 2.12
# python3.6 2.11 # 3.8 <= 2.12
# python3.7 2.11
# Ansible Dependency # Ansible Dependency
# ================== ====================== # ================== ======================

Loading…
Cancel
Save