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

Properly construct collections path #3085

Merged
Merged
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ jobs:
- tox_env: lint
- tox_env: docs
- tox_env: py36
PREFIX: PYTEST_REQPASS=429
PREFIX: PYTEST_REQPASS=430
- tox_env: py37
PREFIX: PYTEST_REQPASS=429
PREFIX: PYTEST_REQPASS=430
- tox_env: py38
PREFIX: PYTEST_REQPASS=429
PREFIX: PYTEST_REQPASS=430
- tox_env: py39
PREFIX: PYTEST_REQPASS=429
PREFIX: PYTEST_REQPASS=430
- tox_env: py36-devel
PREFIX: PYTEST_REQPASS=429
PREFIX: PYTEST_REQPASS=430
- tox_env: py39-devel
PREFIX: PYTEST_REQPASS=429
PREFIX: PYTEST_REQPASS=430
- tox_env: packaging
- tox_env: eco
- tox_env: dockerfile
Expand Down
4 changes: 2 additions & 2 deletions src/molecule/provisioner/ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,8 @@ def default_env(self):
)
]
if collection_indicator in self._config.project_directory:
collection_path, right = self._config.project_directory.split(
collection_indicator
collection_path, right = self._config.project_directory.rsplit(
collection_indicator, 1
)
collections_path_list.append(util.abs_path(collection_path))
collections_path_list.extend(
Expand Down
12 changes: 12 additions & 0 deletions src/molecule/test/unit/provisioner/test_ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,18 @@ def test_default_env_property(_instance):
assert "ANSIBLE_FILTER_PLUGINS" in _instance.env


def test_default_env_property_collections_path(config_instance):
config_instance.project_directory = (
"/some/path/ansible_collections/namespace/collection/but/not/really"
"/ansible_collections/other_ns/other_name/and/some/more/segments"
)

env = ansible.Ansible(config_instance).default_env

paths = env[config_instance.ansible_collections_path].split(":")
assert "/some/path/ansible_collections/namespace/collection/but/not/really" in paths


def test_name_property(_instance):
assert "ansible" == _instance.name

Expand Down