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

Commit 9fc8e35

Browse files
committed
Add molecule 4 compatibility
Move _get_tests() call to execute() that has action_args
1 parent 6092331 commit 9fc8e35

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

molecule_goss/goss.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ def __init__(self, config=None):
9999
:return: None
100100
"""
101101
super(Goss, self).__init__(config)
102-
if config:
103-
self._tests = self._get_tests()
104102

105103
@property
106104
def name(self):
@@ -117,12 +115,17 @@ def default_env(self):
117115
def bake(self):
118116
pass
119117

120-
def execute(self):
118+
def execute(self, action_args=None):
121119
if not self.enabled:
122120
msg = "Skipping, verifier is disabled."
123121
LOG.warning(msg)
124122
return
125123

124+
if self._config:
125+
self._tests = self._get_tests(action_args)
126+
else:
127+
self._tests = []
128+
126129
if not len(self._tests) > 0:
127130
msg = "Skipping, no tests found."
128131
LOG.warning(msg)
@@ -131,12 +134,12 @@ def execute(self):
131134
msg = "Executing Goss tests found in {}/...".format(self.directory)
132135
LOG.info(msg)
133136

134-
self._config.provisioner.verify()
137+
self._config.provisioner.verify(action_args)
135138

136139
msg = "Verifier completed successfully."
137140
LOG.info(msg)
138141

139-
def _get_tests(self):
142+
def _get_tests(self, action_args=None):
140143
"""
141144
Walk the verifier's directory for tests and returns a list.
142145

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ setup_requires =
6868
# These are required in actual runtime:
6969
install_requires =
7070
# molecule plugins are not allowed to mention Ansible as a direct dependency
71-
molecule >= 3.2.0
71+
molecule >= 4.0.0
7272
pyyaml >= 5.1, < 6
7373

7474
[options.extras_require]

0 commit comments

Comments
 (0)