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

Avoid skipping create and destroy steps on delegated #3949

Merged
merged 1 commit into from
Jun 30, 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.
Jump to
Jump to file
Failed to load files.
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: 455
PYTEST_REQPASS: 453
steps:
- uses: actions/checkout@v3
with:
Expand Down
10 changes: 0 additions & 10 deletions src/molecule/command/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,6 @@ def execute(self, action_args=None):
"""
self._config.state.change_state("driver", self._config.driver.name)

if self._config.driver.delegated and not self._config.driver.managed:
msg = "Skipping, instances are delegated."
LOG.warning(msg)
return

if self._config.state.created:
msg = "Skipping, instances already created."
LOG.warning(msg)
return

self._config.provisioner.create()

self._config.state.change_state("created", True)
Expand Down
5 changes: 0 additions & 5 deletions src/molecule/command/destroy.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ def execute(self, action_args=None):
LOG.warning(msg)
return

if self._config.driver.delegated and not self._config.driver.managed:
msg = "Skipping, instances are delegated."
LOG.warning(msg)
return

self._config.provisioner.destroy()
self._config.state.reset()

Expand Down
20 changes: 0 additions & 20 deletions src/molecule/test/unit/command/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,26 +53,6 @@ def test_execute(
assert config_instance.state.created


@pytest.mark.parametrize(
"config_instance",
["command_driver_delegated_section_data"],
indirect=True,
)
def test_execute_skips_when_delegated_driver(
_patched_create_setup,
caplog,
command_patched_ansible_create,
config_instance,
):
c = create.Create(config_instance)
c.execute()

msg = "Skipping, instances are delegated."
assert msg in caplog.text

assert not command_patched_ansible_create.called


@pytest.mark.skip(reason="create not running for delegated")
def test_execute_skips_when_instances_already_created(
caplog,
Expand Down
20 changes: 0 additions & 20 deletions src/molecule/test/unit/command/test_destroy.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,3 @@ def test_execute_skips_when_destroy_strategy_is_never(
assert msg in caplog.text

assert not _patched_ansible_destroy.called


@pytest.mark.parametrize(
"config_instance",
["command_driver_delegated_section_data"],
indirect=True,
)
def test_execute_skips_when_delegated_driver(
_patched_destroy_setup,
caplog,
_patched_ansible_destroy,
config_instance,
):
d = destroy.Destroy(config_instance)
d.execute()

msg = "Skipping, instances are delegated."
assert msg in caplog.text

assert not _patched_ansible_destroy.called