From abb05c98f3cd0770cce69f4d90f00d4f2800060f Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Mon, 9 Jul 2018 11:24:51 -0500 Subject: [PATCH] Make sure we are comparing bytes extensions in inventory plugins (#42475) * Ensure we are comparing text paths with extensions. Fixes #42118 * Add changelog --- changelogs/fragments/inventory_dir_ext_compare_fix.yaml | 2 ++ lib/ansible/inventory/manager.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/inventory_dir_ext_compare_fix.yaml 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