diff --git a/changelogs/fragments/77544-fix-error-yaml-inventory-int-hostnames.yml b/changelogs/fragments/77544-fix-error-yaml-inventory-int-hostnames.yml new file mode 100644 index 00000000000..aa389b12d5d --- /dev/null +++ b/changelogs/fragments/77544-fix-error-yaml-inventory-int-hostnames.yml @@ -0,0 +1,2 @@ +bugfixes: + - yaml inventory plugin - fix the error message for non-string hostnames (https://github.com/ansible/ansible/issues/77519). diff --git a/test/integration/targets/inventory_yaml/runme.sh b/test/integration/targets/inventory_yaml/runme.sh index b82f499d162..a8818dd99bb 100755 --- a/test/integration/targets/inventory_yaml/runme.sh +++ b/test/integration/targets/inventory_yaml/runme.sh @@ -2,3 +2,5 @@ # handle empty/commented out group keys correctly https://github.com/ansible/ansible/issues/47254 ANSIBLE_VERBOSITY=0 diff -w <(ansible-inventory -i ./test.yml --list) success.json + +ansible-inventory -i ./test_int_hostname.yml --list 2>&1 | grep 'Host pattern 1234 must be a string' diff --git a/test/integration/targets/inventory_yaml/test_int_hostname.yml b/test/integration/targets/inventory_yaml/test_int_hostname.yml new file mode 100644 index 00000000000..d2285cb990a --- /dev/null +++ b/test/integration/targets/inventory_yaml/test_int_hostname.yml @@ -0,0 +1,5 @@ +all: + children: + kids: + hosts: + 1234: {}