# 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

    - assert:
        that:
        - not out.changed
        - out.rc == 1
        # ansible/62d8c8fde6a76d9c567ded381e9b34dad69afcd6
        - |
          (ansible_version.full < '2.7' and out.msg == "MODULE FAILURE") or
          (ansible_version.full >= '2.7' and
           out.msg == (
            "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"
