Skip to content

Commit 3fbaa68

Browse files
apatardziegenbergssbarnea
authored
Ensure external drivers are installed (#3901)
If someone try installing plugins (say docker) with molecule[docker], nothing will get installed as it should be molecule-plugins or molecule-plugins[docker]. This leads to a python backtrace similar to the one found in #3883. This should be handled properly, so check that the driver is in api.drivers() before trying to get the value. Signed-off-by: Arnaud Patard <[email protected]> Co-authored-by: Daniel Ziegenberg <[email protected]> Co-authored-by: Sorin Sbarnea <[email protected]>
1 parent b39f926 commit 3fbaa68

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/molecule/config.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,12 @@ def driver(self):
182182
driver_name = self._get_driver_name()
183183
driver = None
184184

185-
driver = api.drivers(config=self)[driver_name]
185+
api_drivers = api.drivers(config=self)
186+
if driver_name not in api_drivers:
187+
msg = f"Failed to find driver {driver_name}. Please ensure that the driver is correctly installed."
188+
util.sysexit_with_message(msg)
189+
190+
driver = api_drivers[driver_name]
186191
driver.name = driver_name
187192

188193
return driver

0 commit comments

Comments
 (0)