diff options
author | Brian Coca <bcoca@users.noreply.github.com> | 2021-01-18 15:33:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-18 15:33:51 +0100 |
commit | 1e27d4052a95d8f19c63d6a37909b3ec690ac832 (patch) | |
tree | 8a449be4960834d390d4f431e06532c66c0b501d /test/integration/targets/inventory/runme.sh | |
parent | add changelog fragment for 73176 (#73259) (diff) | |
download | ansible-1e27d4052a95d8f19c63d6a37909b3ec690ac832.tar.xz ansible-1e27d4052a95d8f19c63d6a37909b3ec690ac832.zip |
fix inventory source parse error handling (#73160)
fixes #51025
added test cases
Diffstat (limited to '')
-rwxr-xr-x | test/integration/targets/inventory/runme.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/integration/targets/inventory/runme.sh b/test/integration/targets/inventory/runme.sh index 02b6bca4e0..1f5470cfa3 100755 --- a/test/integration/targets/inventory/runme.sh +++ b/test/integration/targets/inventory/runme.sh @@ -37,3 +37,15 @@ ANSIBLE_TRANSFORM_INVALID_GROUP_CHARS=never ansible-playbook -i ../../inventory # test extra vars ansible-inventory -i testhost, -i ./extra_vars_constructed.yml --list -e 'from_extras=hey ' "$@"|grep '"example": "hellohey"' + +# test parse inventory fail is not an error per config +ANSIBLE_INVENTORY_UNPARSED_FAILED=False ANSIBLE_INVENTORY_ANY_UNPARSED_IS_FAILED=False ansible -m ping localhost -i /idontexist "$@" + +# test no inventory parse is an error with var +[ "$(ANSIBLE_INVENTORY_UNPARSED_FAILED=True ANSIBLE_INVENTORY_ANY_UNPARSED_IS_FAILED=False ansible -m ping localhost -i /idontexist)" != "0" ] + +# test single inventory no parse is not an error with var +ANSIBLE_INVENTORY_UNPARSED_FAILED=True ANSIBLE_INVENTORY_ANY_UNPARSED_IS_FAILED=False ansible -m ping localhost -i /idontexist -i ../../invenotory "$@" + +# test single inventory no parse is an error with any var +[ "$(ANSIBLE_INVENTORY_ANY_UNPARSED_IS_FAILED=True ansible -m ping localhost -i /idontexist -i ../../invenotory)" != "0" ] |