diff --git a/changelogs/fragments/inventory_dir_ext_compare_fix.yaml b/changelogs/fragments/inventory_dir_ext_compare_fix.yaml new file mode 100644 index 0000000000..7a06919f8c --- /dev/null +++ b/changelogs/fragments/inventory_dir_ext_compare_fix.yaml @@ -0,0 +1,2 @@ +bugfixes: +- inventory - When using an inventory directory, ensure extension comparison uses text types (https://github.com/ansible/ansible/pull/42475) diff --git a/lib/ansible/inventory/manager.py b/lib/ansible/inventory/manager.py index e93884eecd..6d6dfbd6c8 100644 --- a/lib/ansible/inventory/manager.py +++ b/lib/ansible/inventory/manager.py @@ -258,7 +258,7 @@ class InventoryManager(object): # initialize and figure out if plugin wants to attempt parsing this file try: - plugin_wants = bool(plugin.verify_file(source)) + plugin_wants = bool(plugin.verify_file(to_text(source))) except Exception: plugin_wants = False