Commit 1706d54
authored
Workaround for no Exception issue for some failed ansible modules (#1786)
Currently pytest-ansible depends on the 'failed' or 'rc' field in the module result
to determine whether the result is failed. Some ansible modules only have 'failed'
field in their results. Due to an issue of pytest-ansible:
ansible/pytest-ansible#47
The module results returned by pytest-ansible do not have such 'failed' field
even when the ansible module failed. In this case, the `is_failed` property will
always be `False`. Consequent, no exception will be raised when running
some ansible module failed.
This commit is a workaround for this issue. According to current ansible
behavior, the 'exception' field will be available in failed ansible module result
most of the time. When such field is observed in the result, we raise
`RunAnsibleModuleFail` exception too.
Signed-off-by: Xin Wang <xiwang5@microsoft.com>1 parent 1d2fa82 commit 1706d54
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| |||
0 commit comments