File: crashy_new_style_module.yml

package info (click to toggle)
python-mitogen 0.3.36-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,708 kB
  • sloc: python: 24,457; sh: 198; makefile: 74; perl: 19; ansic: 18
file content (35 lines) | stat: -rw-r--r-- 1,273 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# issue #527: catch exceptions from crashy modules.

- name: integration/runner/crashy_new_style_module.yml
  hosts: test-targets
  tasks:
    - custom_python_run_script:
        script: kaboom
      register: out
      ignore_errors: true

    - 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:
        - not out.changed
        - out is failed
        # https://github.com/ansible/ansible/commit/62d8c8fde6a76d9c567ded381e9b34dad69afcd6
        - |
          out.msg is match(msg_pattern)
          or out.msg in (
             "Task failed: Module failed: name 'kaboom' is not defined",
             'Module result deserialization failed: No start of json char found',
          )
        # - out.exception is undefined
        #   or out.exception | default('') is match(tb_pattern)
        #   or out.module_stderr is search(tb_pattern)
        # - out.module_stdout == ''
        # - out.module_stderr is search(tb_pattern)
        fail_msg: |
          out={{ out }}
  tags:
    - crashy_new_style_module