File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -374,11 +374,13 @@ def run( # ruff: disable=PLR0913
374374 tee : bool = False ,
375375 env : dict [str , str ] | None = None ,
376376 cwd : Path | None = None ,
377+ set_acp : bool = True ,
377378 ) -> CompletedProcess :
378379 """Execute a command inside an Ansible environment.
379380
380381 :param retry: Retry network operations on failures.
381382 :param tee: Also pass captured stdout/stderr to system while running.
383+ :param set_acp: Set the ANSIBLE_COLLECTIONS_PATH
382384 """
383385 if tee :
384386 run_func : Callable [..., CompletedProcess ] = subprocess_tee .run
@@ -392,8 +394,7 @@ def run( # ruff: disable=PLR0913
392394 # https://github.com/ansible/ansible-lint/issues/3522
393395 env ["ANSIBLE_VERBOSE_TO_STDERR" ] = "True"
394396
395- # Assume the caller has a proper env, if not use a sane default
396- if "ANSIBLE_COLLECTIONS_PATH" not in env :
397+ if set_acp :
397398 env ["ANSIBLE_COLLECTIONS_PATH" ] = ":" .join (self .config .collections_paths )
398399
399400 for _ in range (self .max_retries + 1 if retry else 1 ):
You can’t perform that action at this time.
0 commit comments