Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Add molecule 4 compatibility #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
13 changes: 8 additions & 5 deletions molecule_goss/goss.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ def __init__(self, config=None):
:return: None
"""
super(Goss, self).__init__(config)
if config:
self._tests = self._get_tests()

@property
def name(self):
Expand All @@ -117,12 +115,17 @@ def default_env(self):
def bake(self):
pass

def execute(self):
def execute(self, action_args=None):
if not self.enabled:
msg = "Skipping, verifier is disabled."
LOG.warning(msg)
return

if self._config:
self._tests = self._get_tests(action_args)
else:
self._tests = []

if not len(self._tests) > 0:
msg = "Skipping, no tests found."
LOG.warning(msg)
Expand All @@ -131,12 +134,12 @@ def execute(self):
msg = "Executing Goss tests found in {}/...".format(self.directory)
LOG.info(msg)

self._config.provisioner.verify()
self._config.provisioner.verify(action_args)

msg = "Verifier completed successfully."
LOG.info(msg)

def _get_tests(self):
def _get_tests(self, action_args=None):
"""
Walk the verifier's directory for tests and returns a list.

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ setup_requires =
# These are required in actual runtime:
install_requires =
# molecule plugins are not allowed to mention Ansible as a direct dependency
molecule >= 3.2.0
molecule >= 4.0.0
pyyaml >= 5.1, < 6

[options.extras_require]
Expand Down