diff options
author | Matt Clay <matt@mystile.com> | 2019-06-26 02:16:46 +0200 |
---|---|---|
committer | Matt Clay <matt@mystile.com> | 2019-06-27 00:45:46 +0200 |
commit | f10918475379ec2314b62bbe6d2053f344cc8368 (patch) | |
tree | 0d682465a4172f0bf4c37827feec5ddd56e86362 /test/integration/targets/module_tracebacks | |
parent | Encoding fixes to support py2 and py3 non-ascii paths (#58414) (diff) | |
download | ansible-f10918475379ec2314b62bbe6d2053f344cc8368.tar.xz ansible-f10918475379ec2314b62bbe6d2053f344cc8368.zip |
Recognize module tracebacks on stdout and stderr.
Module tracebacks may be reported on stdout instead of stderr when
using some connection plugins. For example, the ssh connection plugin
will report tracebacks on stdout due to use of the -tt option.
This change results in tracebacks being recognized on both stdout
and stderr, instead of the previous behavior of just stderr.
ci_complete
Diffstat (limited to 'test/integration/targets/module_tracebacks')
4 files changed, 33 insertions, 0 deletions
diff --git a/test/integration/targets/module_tracebacks/aliases b/test/integration/targets/module_tracebacks/aliases new file mode 100644 index 0000000000..93fb6f10c1 --- /dev/null +++ b/test/integration/targets/module_tracebacks/aliases @@ -0,0 +1,2 @@ +shippable/posix/group4 +needs/ssh diff --git a/test/integration/targets/module_tracebacks/inventory b/test/integration/targets/module_tracebacks/inventory new file mode 100644 index 0000000000..9156526779 --- /dev/null +++ b/test/integration/targets/module_tracebacks/inventory @@ -0,0 +1,5 @@ +testhost_local ansible_connection=local +testhost_ssh ansible_connection=ssh ansible_host=localhost + +[all:vars] +ansible_python_interpreter="{{ ansible_playbook_python }}" diff --git a/test/integration/targets/module_tracebacks/runme.sh b/test/integration/targets/module_tracebacks/runme.sh new file mode 100755 index 0000000000..b8ac8068b0 --- /dev/null +++ b/test/integration/targets/module_tracebacks/runme.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -eux + +ansible-playbook traceback.yml -i inventory "$@" diff --git a/test/integration/targets/module_tracebacks/traceback.yml b/test/integration/targets/module_tracebacks/traceback.yml new file mode 100644 index 0000000000..b1f0b5164a --- /dev/null +++ b/test/integration/targets/module_tracebacks/traceback.yml @@ -0,0 +1,21 @@ +- hosts: all + gather_facts: no + tasks: + - name: intentionally fail module execution + ping: + data: crash + ignore_errors: yes + register: ping + +- hosts: localhost + gather_facts: no + tasks: + - name: verify exceptions were properly captured + assert: + that: + - hostvars.testhost_local.ping is failed + - "'boom' in hostvars.testhost_local.ping.exception" + - "'boom' in hostvars.testhost_local.ping.module_stderr" + - hostvars.testhost_ssh.ping is failed + - "'boom' in hostvars.testhost_ssh.ping.exception" + - "'boom' in hostvars.testhost_ssh.ping.module_stdout" |