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 ")