Debian Codegraph @

test/integration/targets/debug/errors.yml

raw
1 # The debug action bypasses standard task arg templating.
2 # Failures during templating occur when running the debug action.
3
4 - name: Ensure debug templating failures are handled properly
5 debug:
6 msg: "{{ 5 / 0 | int }}"
7 ignore_errors: true
8 register: result
9
10 - debug:
11 var: result
12
13 - assert:
14 that:
15 - result is failed
16 - "'division by zero' in result.msg"
17 - result.exception is defined
18
19 - name: Ensure debug templating failures do not stop later loop iterations
20 debug:
21 msg: "{{ 5 / item }}"
22 ignore_errors: true
23 register: result
24 loop: [0, 0, 1]
25
26 - assert:
27 that:
28 - result.results[0] is failed
29 - "'division by zero' in result.results[0].msg"
30 - result.results[0].exception is defined
31 - result.results[0].item == 0
32
33 - result.results[1] is failed
34 - "'division by zero' in result.results[1].msg"
35 - result.results[1].exception is defined
36 - result.results[1].item == 0
37
38 - result.results[2] is success
39 - result.results[2].msg == 5.0
40 - result.results[2].exception is undefined
41 - result.results[2].item == 1
42
43 - name: var templating exception
44 debug:
45 var: 5/0
46 ignore_errors: true
47 register: result
48
49 - assert:
50 that:
51 - result is failed
52 - '"division by zero" in result.msg'
53
54 - name: undefined warnings in `var` template
55 debug:
56 var: something_undefined
57 register: result
58
59 - assert:
60 that:
61 - result is success
62 - result.warnings | length == 1
63 - result.warnings[0] is contains "something_undefined"
64
65 - name: composite template with embedded undefined
66 debug:
67 msg: mixed composite {{ "valid template" }} {{ bogus_var }} {{ another_bogus_var }} {{ "another valid template" }}
68 ignore_errors: true
69 register: result
70
71 - assert:
72 that:
73 - result is failed
74 - result.msg | regex_search("'bogus_var' is undefined") is not none