From 40d364985dee5d4afecc478547f765574b3e41d6 Mon Sep 17 00:00:00 2001 From: xzeck Date: Mon, 13 Jan 2025 12:51:49 -0400 Subject: host_group_vars - fix Python API traceback caused by undefined 'key' variable (#84488) Fixes: Traceback (most recent call last): File "/home/shertel/ansible/lib/ansible/plugins/vars/host_group_vars.py", line 139, in get_vars FOUND[key] = found_files = loader.find_vars_files(opath, entity_name) ^^^ UnboundLocalError: cannot access local variable 'key' where it is not associated with a value During handling of the above exception, another exception occurred: Traceback (most recent call last): File "", line 1, in File "/home/shertel/ansible/lib/ansible/plugins/vars/host_group_vars.py", line 151, in get_vars raise AnsibleParserError(to_native(e)) ansible.errors.AnsibleParserError: cannot access local variable 'key' where it is not associated with a value --- changelogs/fragments/84384-fix-undefined-key-host-group-vars.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changelogs/fragments/84384-fix-undefined-key-host-group-vars.yml (limited to 'changelogs') diff --git a/changelogs/fragments/84384-fix-undefined-key-host-group-vars.yml b/changelogs/fragments/84384-fix-undefined-key-host-group-vars.yml new file mode 100644 index 0000000000..00f7117d80 --- /dev/null +++ b/changelogs/fragments/84384-fix-undefined-key-host-group-vars.yml @@ -0,0 +1,4 @@ +# Filename: changelogs/fragments/84384-fix-undefined-key-host-group-vars.yml + +bugfixes: + - host_group_vars - fixed defining the 'key' variable if the get_vars method is called with cache=False (https://github.com/ansible/ansible/issues/84384) -- cgit v1.2.3