From 26e6194d0afe09e54581178cc21f900f1ad36c5e Mon Sep 17 00:00:00 2001 From: David Wilson Date: Tue, 19 Feb 2019 16:26:47 +0000 Subject: [PATCH] issue #548: always treat transport=smart as 'ssh' for mitogen_via=. The idea behind transport=smart is to select between paramiko and OpenSSH given the availability of connection multiplexing and/or OSX kernel bugs. We need to make no such choice. --- ansible_mitogen/connection.py | 1 + tests/ansible/hosts/transport_config.hosts | 1 + .../integration/transport_config/all.yml | 1 + .../transport_config/transport__smart.yml | 49 +++++++++++++++++++ 4 files changed, 52 insertions(+) create mode 100644 tests/ansible/integration/transport_config/transport__smart.yml diff --git a/ansible_mitogen/connection.py b/ansible_mitogen/connection.py index 254a4286..fe07f44f 100644 --- a/ansible_mitogen/connection.py +++ b/ansible_mitogen/connection.py @@ -356,6 +356,7 @@ CONNECTION_METHOD = { 'machinectl': _connect_machinectl, 'setns': _connect_setns, 'ssh': _connect_ssh, + 'smart': _connect_ssh, # issue #548. 'su': _connect_su, 'sudo': _connect_sudo, 'doas': _connect_doas, diff --git a/tests/ansible/hosts/transport_config.hosts b/tests/ansible/hosts/transport_config.hosts index d68b2d84..856c6a0f 100644 --- a/tests/ansible/hosts/transport_config.hosts +++ b/tests/ansible/hosts/transport_config.hosts @@ -5,6 +5,7 @@ # tansport() tc-transport-unset tc-transport-local ansible_connection=local +tc-transport-smart ansible_connection=smart # python_path() tc-python-path-unset diff --git a/tests/ansible/integration/transport_config/all.yml b/tests/ansible/integration/transport_config/all.yml index 64199314..d4ed832f 100644 --- a/tests/ansible/integration/transport_config/all.yml +++ b/tests/ansible/integration/transport_config/all.yml @@ -8,3 +8,4 @@ - include: remote_addr.yml - include: remote_user.yml - include: transport.yml +- include: transport__smart.yml diff --git a/tests/ansible/integration/transport_config/transport__smart.yml b/tests/ansible/integration/transport_config/transport__smart.yml new file mode 100644 index 00000000..a4c1959f --- /dev/null +++ b/tests/ansible/integration/transport_config/transport__smart.yml @@ -0,0 +1,49 @@ +# issue #548 +# Each case is followed by mitogen_via= case to test hostvars method. + + +# When no ansible_connection= is set, transport comes via ansible.cfg ("smart" +# is parsed away to either paramiko or ssh). +- name: integration/transport_config/transport.yml + hosts: tc-transport-smart + tasks: + - include: ../_mitogen_only.yml + - {mitogen_get_stack: {}, register: out} + - assert_equal: + left: out.result[0].method + right: "ssh" + +- hosts: tc-transport-local + vars: {mitogen_via: tc-transport-smart} + tasks: + - include: ../_mitogen_only.yml + - {mitogen_get_stack: {}, register: out} + - assert_equal: + left: out.result[0].method + right: "ssh" + - assert_equal: + left: out.result[1].method + right: "local" + + +# ansible_connection=local + +- hosts: tc-transport-local + tasks: + - include: ../_mitogen_only.yml + - {mitogen_get_stack: {}, register: out} + - assert_equal: + left: out.result[0].method + right: "local" + +- hosts: tc-transport-smart + vars: {mitogen_via: tc-transport-local} + tasks: + - include: ../_mitogen_only.yml + - {mitogen_get_stack: {}, register: out} + - assert_equal: + left: out.result[0].method + right: "local" + - assert_equal: + left: out.result[1].method + right: "ssh"