From 4f0ec5a9a0c0199d1ddf0d513a8b98efa3714c20 Mon Sep 17 00:00:00 2001 From: Satyajit Bulage Date: Fri, 3 Jul 2020 01:52:21 +0530 Subject: [PATCH] Suppress warning for user directory in ansible-inventory (#65344) When user uses home directory in --playbook-dir option of ansible-inventory command, it warns user about this. This PR suppress the warning message for user's home directory usage in ansible-inventory command. Fixes: #65262 Signed-off-by: Satyajit Bulage --- changelogs/fragments/65262_ansible_inventory.yml | 2 ++ lib/ansible/plugins/loader.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/65262_ansible_inventory.yml diff --git a/changelogs/fragments/65262_ansible_inventory.yml b/changelogs/fragments/65262_ansible_inventory.yml new file mode 100644 index 00000000000..bc2dd6c57d3 --- /dev/null +++ b/changelogs/fragments/65262_ansible_inventory.yml @@ -0,0 +1,2 @@ +bugfixes: +- Suppress warning when user directory used in --playbook-dir option with ansible-inventory command (https://github.com/ansible/ansible/issues/65262). diff --git a/lib/ansible/plugins/loader.py b/lib/ansible/plugins/loader.py index 49b85e57ace..755be2ffb8b 100644 --- a/lib/ansible/plugins/loader.py +++ b/lib/ansible/plugins/loader.py @@ -61,7 +61,7 @@ def get_all_plugin_loaders(): def add_all_plugin_dirs(path): ''' add any existing plugin dirs in the path provided ''' - b_path = to_bytes(path, errors='surrogate_or_strict') + b_path = os.path.expanduser(to_bytes(path, errors='surrogate_or_strict')) if os.path.isdir(b_path): for name, obj in get_all_plugin_loaders(): if obj.subdir: