diff --git a/molecule/command/verify.py b/molecule/command/verify.py index f6c1142c8..34e4e3dda 100644 --- a/molecule/command/verify.py +++ b/molecule/command/verify.py @@ -71,10 +71,6 @@ def execute(self): :return: None """ self.print_info() - if not self._config.provisioner.playbooks.verify: - msg = 'Skipping, verify playbook not configured.' - LOG.warning(msg) - return self._config.verifier.execute() diff --git a/molecule/provisioner/ansible.py b/molecule/provisioner/ansible.py index c4e68525b..2a0123ecc 100644 --- a/molecule/provisioner/ansible.py +++ b/molecule/provisioner/ansible.py @@ -751,6 +751,10 @@ def verify(self): :return: None """ + if not self.playbooks.verify: + LOG.warning('Skipping, verify playbook not configured.') + return + pb = self._get_ansible_playbook(self.playbooks.verify) pb.execute() diff --git a/molecule/test/unit/provisioner/test_ansible.py b/molecule/test/unit/provisioner/test_ansible.py index 108befb5b..a317d6328 100644 --- a/molecule/test/unit/provisioner/test_ansible.py +++ b/molecule/test/unit/provisioner/test_ansible.py @@ -584,10 +584,11 @@ def test_syntax(_instance, mocker, _patched_ansible_playbook): def test_verify(_instance, mocker, _patched_ansible_playbook): _instance.verify() - _patched_ansible_playbook.assert_called_once_with( - _instance._config.provisioner.playbooks.verify, _instance._config - ) - _patched_ansible_playbook.return_value.execute.assert_called_once_with() + if _instance._config.provisioner.playbooks.verify: + _patched_ansible_playbook.assert_called_once_with( + _instance._config.provisioner.playbooks.verify, _instance._config + ) + _patched_ansible_playbook.return_value.execute.assert_called_once_with() def test_write_config(temp_dir, _instance): diff --git a/setup.cfg b/setup.cfg index 4a4e4fd0a..f5c015d07 100644 --- a/setup.cfg +++ b/setup.cfg @@ -119,6 +119,7 @@ test = pytest-xdist>=1.29.0, < 2 pytest>=4.6.3, < 5 shade>=1.31.0, < 2 + testinfra >= 3.4.0 lint = ansible-lint >= 4.1.1a2, < 5 flake8 >= 3.6.0