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

Disable isolation from ansible-compat Runtime #3962

Merged
merged 1 commit into from
Jul 10, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
matrix: ${{ fromJson(needs.pre.outputs.matrix) }}

env:
PYTEST_REQPASS: 446
PYTEST_REQPASS: 445
steps:
- uses: actions/checkout@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion src/molecule/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class App:

def __init__(self) -> None:
"""Create a new app instance."""
self.runtime = Runtime(isolated=True)
self.runtime = Runtime(isolated=False)


app = App()
9 changes: 0 additions & 9 deletions src/molecule/provisioner/ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,12 +462,6 @@ def default_env(self):
# top of the collection_path_list. This prevents dependency commands
# from installing dependencies to user list of collections.
collections_path_list = [
util.abs_path(
os.path.join(
self._config.scenario.config.runtime.cache_dir,
"collections",
),
),
util.abs_path(
os.path.join(self._config.scenario.ephemeral_directory, "collections"),
),
Expand Down Expand Up @@ -499,9 +493,6 @@ def default_env(self):
)

roles_path_list = [
util.abs_path(
os.path.join(self._config.scenario.config.runtime.cache_dir, "roles"),
),
util.abs_path(
os.path.join(self._config.scenario.ephemeral_directory, "roles"),
),
Expand Down
39 changes: 0 additions & 39 deletions src/molecule/test/a_unit/command/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,45 +216,6 @@ def test_execute_cmdline_scenarios_exit_nodestroy(
assert not _patched_sysexit.called


def test_runtime_paths(config_instance: config.Config, _patched_sysexit):
# the ansible_collections_path and ansible_roles_path from the runtime
# should be added to the provisioner's paths
scenario_name = None
args: dict[str, str] = {}
command_args = {"destroy": "never", "subcommand": "verify"}

base.result_callback()
base.execute_cmdline_scenarios(scenario_name, args, command_args)

home = os.path.expanduser("~")
cache_dir = config_instance.runtime.cache_dir
runtime_roles_path = config_instance.runtime.environ.get("ANSIBLE_ROLES_PATH")
assert isinstance(runtime_roles_path, str)
provisioner_roles_path = config_instance.provisioner.env.get("ANSIBLE_ROLES_PATH")
runtime_collections_path = config_instance.runtime.environ.get(
config_instance.ansible_collections_path,
)
assert isinstance(runtime_collections_path, str)
provisioner_collections_path = config_instance.provisioner.env.get(
config_instance.ansible_collections_path,
)

assert runtime_roles_path.startswith(
f"{cache_dir}/roles:"
f"{home}/.ansible/roles:"
f"/usr/share/ansible/roles:"
f"/etc/ansible/roles",
)

assert runtime_collections_path.startswith(
f"{cache_dir}/collections:{home}/.ansible/collections",
)

assert provisioner_roles_path.startswith(f"{cache_dir}/roles")

assert provisioner_collections_path.startswith(f"{cache_dir}/collections")


def test_execute_subcommand(config_instance: config.Config):
# scenario's config.action is mutated in-place for every sequence action,
# so make sure that is currently set to the executed action
Expand Down