From 90f89f95fbcda4059b1306d4f980b87759c38ca8 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Mon, 10 Sep 2018 01:31:15 +0100 Subject: [PATCH] ansible: fix exec_command() regression. --- ansible_mitogen/connection.py | 2 +- tests/ansible/integration/connection/all.yml | 1 + .../integration/connection/exec_command.yml | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 tests/ansible/integration/connection/exec_command.yml diff --git a/ansible_mitogen/connection.py b/ansible_mitogen/connection.py index 4ec00308..c5c96f24 100644 --- a/ansible_mitogen/connection.py +++ b/ansible_mitogen/connection.py @@ -789,7 +789,7 @@ class Connection(ansible.plugins.connection.ConnectionBase): (return code, stdout bytes, stderr bytes) """ emulate_tty = (not in_data and sudoable) - rc, stdout, stderr = self.call( + rc, stdout, stderr = self.get_chain().call( ansible_mitogen.target.exec_command, cmd=mitogen.utils.cast(cmd), in_data=mitogen.utils.cast(in_data), diff --git a/tests/ansible/integration/connection/all.yml b/tests/ansible/integration/connection/all.yml index 96018d1a..123e11c4 100644 --- a/tests/ansible/integration/connection/all.yml +++ b/tests/ansible/integration/connection/all.yml @@ -1,4 +1,5 @@ --- +- import_playbook: exec_command.yml - import_playbook: put_small_file.yml - import_playbook: put_large_file.yml diff --git a/tests/ansible/integration/connection/exec_command.yml b/tests/ansible/integration/connection/exec_command.yml new file mode 100644 index 00000000..6a632961 --- /dev/null +++ b/tests/ansible/integration/connection/exec_command.yml @@ -0,0 +1,19 @@ +# Test basic functinality of exec_command. +--- + +- name: integration/connection/exec_command.yml + hosts: test-targets + gather_facts: no + any_errors_fatal: true + tasks: + - connection_passthrough: + method: exec_command + kwargs: + cmd: echo "hello, world" + register: out + + - assert: + that: + - out.result[0] == 0 + - out.result[1] == "hello, world\r\n" + - out.result[2].startswith("Shared connection to ")