CI: Handle NameError traceback on stdout in Ansible 2.10+

pull/859/head
Alex Willmer 3 years ago
parent 2b27384a93
commit 147a716b28

@ -8,19 +8,18 @@
register: out register: out
ignore_errors: true ignore_errors: true
- assert: - name: Check error report
vars:
msg_pattern: "MODULE FAILURE(?:\nSee stdout/stderr for the exact error)?"
# (?s) -> . matches any character, even newlines
tb_pattern: "(?s)Traceback \\(most recent call last\\).+NameError: name 'kaboom' is not defined"
assert:
that: that:
- not out.changed - not out.changed
- out.rc == 1 - out.rc == 1
# ansible/62d8c8fde6a76d9c567ded381e9b34dad69afcd6 # https://github.com/ansible/ansible/commit/62d8c8fde6a76d9c567ded381e9b34dad69afcd6
- | - out.msg is match(msg_pattern)
(ansible_version.full is version('2.7', '<') and out.msg == "MODULE FAILURE") or - (out.module_stdout == "" and out.module_stderr is search(tb_pattern))
(ansible_version.full is version('2.7', '>=') and or
out.msg == ( (out.module_stdout is search(tb_pattern) and out.module_stderr is match("Shared connection to localhost closed."))
"MODULE FAILURE\n" +
"See stdout/stderr for the exact error"
))
- out.module_stdout == ""
- "'Traceback (most recent call last)' in out.module_stderr"
- "\"NameError: name 'kaboom' is not defined\" in out.module_stderr"
fail_msg: out={{out}} fail_msg: out={{out}}

Loading…
Cancel
Save