Skip to content

Commit fe8ae39

Browse files
authored
Revert #196 for ansible 2.9 (#202)
1 parent cf0bb6b commit fe8ae39

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/tox_ansible/plugin.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,10 +534,17 @@ def conf_passenv() -> list[str]:
534534
def conf_setenv(env_conf: EnvConfigSet) -> str:
535535
"""Build the set environment variables for the tox environment.
536536
537+
ansible 2.9 did not support the ANSIBLE_COLLECTION_PATH environment variable
538+
ansible 2.16 has it marked for deprecation in 2.19
539+
537540
:param env_conf: The environment configuration.
538541
:return: The set environment variables.
539542
"""
543+
if env_conf.name.endswith("2.9"):
544+
envvar_name = "ANSIBLE_COLLECTIONS_PATHS"
545+
else:
546+
envvar_name = "ANSIBLE_COLLECTIONS_PATH"
540547
envtmpdir = env_conf["envtmpdir"]
541548
setenv = []
542-
setenv.append(f"ANSIBLE_COLLECTIONS_PATH={envtmpdir}/collections/")
549+
setenv.append(f"{envvar_name}={envtmpdir}/collections/")
543550
return "\n".join(setenv)

0 commit comments

Comments
 (0)