Skip to content

Commit

Permalink
Avoid skipping create and destroy steps on delegated (#3949)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea authored Jun 30, 2023
1 parent 042bb8d commit 6c39dc5
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 56 deletions.
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

0 comments on commit 6c39dc5

Please sign in to comment.