Skip to content

Commit

Permalink
Avoid running prepare ansible paths twice (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea authored Sep 18, 2024
1 parent 953ca52 commit d791c2a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/ansible_compat/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,9 @@ def run( # ruff: disable=PLR0913
env["ANSIBLE_VERBOSE_TO_STDERR"] = "True"

if set_acp:
env["ANSIBLE_COLLECTIONS_PATH"] = ":".join(self.config.collections_paths)
env["ANSIBLE_COLLECTIONS_PATH"] = ":".join(
list(dict.fromkeys(self.config.collections_paths)),
)

for _ in range(self.max_retries + 1 if retry else 1):
result = run_func(
Expand Down Expand Up @@ -636,6 +638,7 @@ def prepare_environment( # noqa: C901
if required_collections is None:
required_collections = {}

self._prepare_ansible_paths()
# first one is standard for collection layout repos and the last two
# are part of Tower specification
# https://docs.ansible.com/ansible-tower/latest/html/userguide/projects.html#ansible-galaxy-support
Expand All @@ -646,8 +649,6 @@ def prepare_environment( # noqa: C901
file_path = self.project_dir / req_file
self.install_requirements(file_path, retry=retry, offline=offline)

self._prepare_ansible_paths()

if not install_local:
return

Expand Down

0 comments on commit d791c2a

Please sign in to comment.