Skip to content

Commit a9387df

Browse files
authored
Use correct init_plugin_loader (#444)
1 parent 5d657e5 commit a9387df

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/ansible_compat/runtime.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -343,20 +343,16 @@ def _ensure_module_available(self) -> None:
343343
if not Runtime.initialized:
344344
col_path = [f"{self.cache_dir}/collections"]
345345
# noinspection PyProtectedMember
346+
# pylint: disable=import-outside-toplevel,no-name-in-module
347+
from ansible.plugins.loader import init_plugin_loader
346348
from ansible.utils.collection_loader._collection_finder import ( # pylint: disable=import-outside-toplevel
347349
_AnsibleCollectionFinder, # noqa: PLC2701
348350
)
349351

350-
# noinspection PyProtectedMember
351-
# pylint: disable=protected-access
352-
col_path += self.config.collections_paths
353-
col_path += os.path.dirname( # noqa: PTH120
354-
os.environ.get(ansible_collections_path(), "."),
355-
).split(":")
356352
_AnsibleCollectionFinder( # noqa: SLF001
357353
paths=col_path,
358-
)._install() # pylint: disable=protected-access
359-
Runtime.initialized = True
354+
)._remove() # pylint: disable=protected-access
355+
init_plugin_loader(col_path)
360356

361357
def clean(self) -> None:
362358
"""Remove content of cache_dir."""

0 commit comments

Comments
 (0)