From 196a47627065ade98f6d14dfdd32870638cb2fae Mon Sep 17 00:00:00 2001 From: Steven Robertson Date: Thu, 5 Nov 2020 23:45:41 -0800 Subject: [PATCH] :tada: no more warnings, only load specific collection subdirs instead of top-level collection path (ie no ansible_collections/google, only ansible_collections/google/cloud, etc) --- ansible_mitogen/planner.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/ansible_mitogen/planner.py b/ansible_mitogen/planner.py index 5ec8737a..ab44d7e7 100644 --- a/ansible_mitogen/planner.py +++ b/ansible_mitogen/planner.py @@ -43,8 +43,7 @@ import os import random from ansible.executor import module_common -from ansible.galaxy.collection import find_existing_collections -from ansible.utils.collection_loader import AnsibleCollectionConfig +from ansible.collections.list import list_collection_dirs import ansible.errors import ansible.module_utils import ansible.release @@ -572,12 +571,8 @@ def _load_collections(invocation): Goes through all collection path possibilities and stores paths to installed collections Stores them on the current invocation to later be passed to the master service """ - for path in AnsibleCollectionConfig.collection_paths: - if os.path.isdir(path): - collections = find_existing_collections(path, fallback_metadata=True) - - for collection in collections: - invocation._extra_sys_paths.add(collection.b_path.decode('utf-8')) + for collection_path in list_collection_dirs(): + invocation._extra_sys_paths.add(collection_path.decode('utf-8')) def invoke(invocation):