Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert #196 for ansible 2.9 #202

Merged
merged 1 commit into from
Aug 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/tox_ansible/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,10 +534,17 @@ def conf_passenv() -> list[str]:
def conf_setenv(env_conf: EnvConfigSet) -> str:
"""Build the set environment variables for the tox environment.

ansible 2.9 did not support the ANSIBLE_COLLECTION_PATH environment variable
ansible 2.16 has it marked for deprecation in 2.19

:param env_conf: The environment configuration.
:return: The set environment variables.
"""
if env_conf.name.endswith("2.9"):
envvar_name = "ANSIBLE_COLLECTIONS_PATHS"
else:
envvar_name = "ANSIBLE_COLLECTIONS_PATH"
envtmpdir = env_conf["envtmpdir"]
setenv = []
setenv.append(f"ANSIBLE_COLLECTIONS_PATH={envtmpdir}/collections/")
setenv.append(f"{envvar_name}={envtmpdir}/collections/")
return "\n".join(setenv)