Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
moreati committed Sep 15, 2024
1 parent 7eb88d5 commit 7b74a22
Show file tree
Hide file tree
Showing 13 changed files with 201 additions and 229 deletions.
234 changes: 117 additions & 117 deletions .ci/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ trigger:
- docs-master

jobs:
- job: mac12
# vanilla Ansible is really slow
timeoutInMinutes: 120
steps:
- template: azure-pipelines-steps.yml
pool:
# https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md
vmImage: macOS-12
strategy:
matrix:
Mito_312:
tox.env: py312-mode_mitogen
Loc_312_10:
tox.env: py312-mode_localhost-ansible10
Van_312_10:
tox.env: py312-mode_localhost-ansible10-strategy_linear
# - job: mac12
# # vanilla Ansible is really slow
# timeoutInMinutes: 120
# steps:
# - template: azure-pipelines-steps.yml
# pool:
# # https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md
# vmImage: macOS-12
# strategy:
# matrix:
# Mito_312:
# tox.env: py312-mode_mitogen
# Loc_312_10:
# tox.env: py312-mode_localhost-ansible10
# Van_312_10:
# tox.env: py312-mode_localhost-ansible10-strategy_linear

- job: Linux
pool:
Expand All @@ -41,117 +41,117 @@ jobs:
- template: azure-pipelines-steps.yml
strategy:
matrix:
Mito_27_centos6:
tox.env: py27-mode_mitogen-distro_centos6
Mito_27_centos7:
tox.env: py27-mode_mitogen-distro_centos7
Mito_27_centos8:
tox.env: py27-mode_mitogen-distro_centos8
Mito_27_debian9:
tox.env: py27-mode_mitogen-distro_debian9
Mito_27_debian10:
tox.env: py27-mode_mitogen-distro_debian10
Mito_27_debian11:
tox.env: py27-mode_mitogen-distro_debian11
Mito_27_ubuntu1604:
tox.env: py27-mode_mitogen-distro_ubuntu1604
Mito_27_ubuntu1804:
tox.env: py27-mode_mitogen-distro_ubuntu1804
Mito_27_ubuntu2004:
tox.env: py27-mode_mitogen-distro_ubuntu2004
# Mito_27_centos6:
# tox.env: py27-mode_mitogen-distro_centos6
# Mito_27_centos7:
# tox.env: py27-mode_mitogen-distro_centos7
# Mito_27_centos8:
# tox.env: py27-mode_mitogen-distro_centos8
# Mito_27_debian9:
# tox.env: py27-mode_mitogen-distro_debian9
# Mito_27_debian10:
# tox.env: py27-mode_mitogen-distro_debian10
# Mito_27_debian11:
# tox.env: py27-mode_mitogen-distro_debian11
# Mito_27_ubuntu1604:
# tox.env: py27-mode_mitogen-distro_ubuntu1604
# Mito_27_ubuntu1804:
# tox.env: py27-mode_mitogen-distro_ubuntu1804
# Mito_27_ubuntu2004:
# tox.env: py27-mode_mitogen-distro_ubuntu2004

Mito_36_centos6:
python.version: '3.6'
tox.env: py36-mode_mitogen-distro_centos6
Mito_36_centos7:
python.version: '3.6'
tox.env: py36-mode_mitogen-distro_centos7
Mito_36_centos8:
python.version: '3.6'
tox.env: py36-mode_mitogen-distro_centos8
Mito_36_debian9:
python.version: '3.6'
tox.env: py36-mode_mitogen-distro_debian9
Mito_36_debian10:
python.version: '3.6'
tox.env: py36-mode_mitogen-distro_debian10
Mito_36_debian11:
python.version: '3.6'
tox.env: py36-mode_mitogen-distro_debian11
Mito_36_ubuntu1604:
python.version: '3.6'
tox.env: py36-mode_mitogen-distro_ubuntu1604
Mito_36_ubuntu1804:
python.version: '3.6'
tox.env: py36-mode_mitogen-distro_ubuntu1804
Mito_36_ubuntu2004:
python.version: '3.6'
tox.env: py36-mode_mitogen-distro_ubuntu2004
# Mito_36_centos6:
# python.version: '3.6'
# tox.env: py36-mode_mitogen-distro_centos6
# Mito_36_centos7:
# python.version: '3.6'
# tox.env: py36-mode_mitogen-distro_centos7
# Mito_36_centos8:
# python.version: '3.6'
# tox.env: py36-mode_mitogen-distro_centos8
# Mito_36_debian9:
# python.version: '3.6'
# tox.env: py36-mode_mitogen-distro_debian9
# Mito_36_debian10:
# python.version: '3.6'
# tox.env: py36-mode_mitogen-distro_debian10
# Mito_36_debian11:
# python.version: '3.6'
# tox.env: py36-mode_mitogen-distro_debian11
# Mito_36_ubuntu1604:
# python.version: '3.6'
# tox.env: py36-mode_mitogen-distro_ubuntu1604
# Mito_36_ubuntu1804:
# python.version: '3.6'
# tox.env: py36-mode_mitogen-distro_ubuntu1804
# Mito_36_ubuntu2004:
# python.version: '3.6'
# tox.env: py36-mode_mitogen-distro_ubuntu2004

Mito_312_centos6:
python.version: '3.12'
tox.env: py312-mode_mitogen-distro_centos6
Mito_312_centos7:
python.version: '3.12'
tox.env: py312-mode_mitogen-distro_centos7
Mito_312_centos8:
python.version: '3.12'
tox.env: py312-mode_mitogen-distro_centos8
Mito_312_debian9:
python.version: '3.12'
tox.env: py312-mode_mitogen-distro_debian9
Mito_312_debian10:
python.version: '3.12'
tox.env: py312-mode_mitogen-distro_debian10
Mito_312_debian11:
python.version: '3.12'
tox.env: py312-mode_mitogen-distro_debian11
Mito_312_ubuntu1604:
python.version: '3.12'
tox.env: py312-mode_mitogen-distro_ubuntu1604
Mito_312_ubuntu1804:
python.version: '3.12'
tox.env: py312-mode_mitogen-distro_ubuntu1804
Mito_312_ubuntu2004:
python.version: '3.12'
tox.env: py312-mode_mitogen-distro_ubuntu2004
# Mito_312_centos6:
# python.version: '3.12'
# tox.env: py312-mode_mitogen-distro_centos6
# Mito_312_centos7:
# python.version: '3.12'
# tox.env: py312-mode_mitogen-distro_centos7
# Mito_312_centos8:
# python.version: '3.12'
# tox.env: py312-mode_mitogen-distro_centos8
# Mito_312_debian9:
# python.version: '3.12'
# tox.env: py312-mode_mitogen-distro_debian9
# Mito_312_debian10:
# python.version: '3.12'
# tox.env: py312-mode_mitogen-distro_debian10
# Mito_312_debian11:
# python.version: '3.12'
# tox.env: py312-mode_mitogen-distro_debian11
# Mito_312_ubuntu1604:
# python.version: '3.12'
# tox.env: py312-mode_mitogen-distro_ubuntu1604
# Mito_312_ubuntu1804:
# python.version: '3.12'
# tox.env: py312-mode_mitogen-distro_ubuntu1804
# Mito_312_ubuntu2004:
# python.version: '3.12'
# tox.env: py312-mode_mitogen-distro_ubuntu2004

Ans_27_210:
tox.env: py27-mode_ansible-ansible2.10
Ans_27_4:
tox.env: py27-mode_ansible-ansible4
# Ans_27_4:
# tox.env: py27-mode_ansible-ansible4

Ans_36_210:
python.version: '3.6'
tox.env: py36-mode_ansible-ansible2.10
Ans_36_4:
python.version: '3.6'
tox.env: py36-mode_ansible-ansible4
# Ans_36_4:
# python.version: '3.6'
# tox.env: py36-mode_ansible-ansible4

Ans_311_210:
python.version: '3.11'
tox.env: py311-mode_ansible-ansible2.10
Ans_311_3:
python.version: '3.11'
tox.env: py311-mode_ansible-ansible3
Ans_311_4:
python.version: '3.11'
tox.env: py311-mode_ansible-ansible4
Ans_311_5:
python.version: '3.11'
tox.env: py311-mode_ansible-ansible5
Ans_312_6:
python.version: '3.12'
tox.env: py312-mode_ansible-ansible6
Ans_312_7:
python.version: '3.12'
tox.env: py312-mode_ansible-ansible7
Ans_312_8:
python.version: '3.12'
tox.env: py312-mode_ansible-ansible8
Ans_312_9:
python.version: '3.12'
tox.env: py312-mode_ansible-ansible9
# Ans_311_210:
# python.version: '3.11'
# tox.env: py311-mode_ansible-ansible2.10
# Ans_311_3:
# python.version: '3.11'
# tox.env: py311-mode_ansible-ansible3
# Ans_311_4:
# python.version: '3.11'
# tox.env: py311-mode_ansible-ansible4
# Ans_311_5:
# python.version: '3.11'
# tox.env: py311-mode_ansible-ansible5
# Ans_312_6:
# python.version: '3.12'
# tox.env: py312-mode_ansible-ansible6
# Ans_312_7:
# python.version: '3.12'
# tox.env: py312-mode_ansible-ansible7
# Ans_312_8:
# python.version: '3.12'
# tox.env: py312-mode_ansible-ansible8
# Ans_312_9:
# python.version: '3.12'
# tox.env: py312-mode_ansible-ansible9
Ans_312_10:
python.version: '3.12'
tox.env: py312-mode_ansible-ansible10
22 changes: 3 additions & 19 deletions ansible_mitogen/plugins/connection/mitogen_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import os.path
import sys

from ansible.plugins.connection.ssh import DOCUMENTATION as VANILLA_DOC

DOCUMENTATION = """
author: David Wilson <dw@botanicus.net>
connection: mitogen_ssh
Expand All @@ -42,25 +44,7 @@
accepts.
version_added: "2.5"
options:
ssh_args:
type: str
vars:
- name: ssh_args
- name: ansible_ssh_args
- name: ansible_mitogen_ssh_args
ssh_common_args:
type: str
vars:
- name: ssh_args
- name: ansible_ssh_common_args
- name: ansible_mitogen_ssh_common_args
ssh_extra_args:
type: str
vars:
- name: ssh_args
- name: ansible_ssh_extra_args
- name: ansible_mitogen_ssh_extra_args
"""
""" + VANILLA_DOC.partition('options:\n')[2]

try:
import ansible_mitogen
Expand Down
43 changes: 27 additions & 16 deletions ansible_mitogen/transport_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,25 @@ def become(self):
def become_method(self):
return self._play_context.become_method

def _become_option(self, name):
# self._play_context._become_plugin?
plugin = self._connection.become
if plugin is not None:
# hostvars=...?
return plugin.get_option(name, playcontext=self._play_context)

# FIXME BecomeBase.get_option() doesn't do this for ['become_user', 'become_pass', 'become_flags', 'become_exe']
return getattr(self._play_context, name)

def _connection_option(self, name):
try:
# hostvars=...?
return self._connection.get_option(name)
except KeyError:
return getattr(self._play_context, name)

def become_user(self):
return self._play_context.become_user
return self._become_option('become_user')

def become_pass(self):
# become_pass is owned/provided by the active become plugin. However
Expand All @@ -449,17 +466,15 @@ def become_pass(self):
# - `meta: reset_connection` runs `connection.reset()` but
# `ansible_mitogen.connection.Connection.reset()` recreates the
# connection object, setting `connection.become = None`.
become_plugin = self._connection.become
try:
become_pass = become_plugin.get_option('become_pass', playcontext=self._play_context)
except AttributeError:
become_pass = self._play_context.become_pass
return optional_secret(become_pass)
# self._play_context._become_pass?
return optional_secret(self._become_option('become_pass'))

def password(self):
return optional_secret(self._connection_option('password'))
return optional_secret(self._play_context.password)

def port(self):
return self._connection_option('port')
return self._play_context.port

def python_path(self, rediscover_python=False):
Expand All @@ -474,6 +489,7 @@ def python_path(self, rediscover_python=False):
rediscover_python=rediscover_python)

def host_key_checking(self):
return self._connection_option('host_key_checking')
def candidates():
yield self._connection.get_task_var('ansible_ssh_host_key_checking')
yield self._connection.get_task_var('ansible_host_key_checking')
Expand All @@ -482,12 +498,15 @@ def candidates():
return boolean(val)

def private_key_file(self):
return self._connection_option('private_key_file')
return self._play_context.private_key_file

def ssh_executable(self):
return self._connection_option('ssh_executable')
return C.config.get_config_value("ssh_executable", plugin_type="connection", plugin_name="ssh", variables=self._task_vars.get("vars", {}))

def timeout(self):
return self._connection_option('timeout')
return self._play_context.timeout

def ansible_ssh_timeout(self):
Expand All @@ -510,15 +529,7 @@ def ssh_args(self):
]

def become_exe(self):
# In Ansible 2.8, PlayContext.become_exe always has a default value due
# to the new options mechanism. Previously it was only set if a value
# ("somewhere") had been specified for the task.
# For consistency in the tests, here we make older Ansibles behave like
# newer Ansibles.
exe = self._play_context.become_exe
if exe is None and self._play_context.become_method == 'sudo':
exe = 'sudo'
return exe
return self._become_option('become_exe')

def sudo_args(self):
return [
Expand Down
4 changes: 2 additions & 2 deletions tests/ansible/all.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- import_playbook: setup/all.yml
tags: setup
- import_playbook: regression/all.yml
tags: regression
#- import_playbook: regression/all.yml
# tags: regression
- import_playbook: integration/all.yml
tags: integration
Loading

0 comments on commit 7b74a22

Please sign in to comment.