Skip to content

Commit

Permalink
Ensure external drivers are installed (#3901)
Browse files Browse the repository at this point in the history
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 <apatard@hupstream.com>
Co-authored-by: Daniel Ziegenberg <daniel@ziegenberg.at>
Co-authored-by: Sorin Sbarnea <ssbarnea@redhat.com>
  • Loading branch information
3 people committed Jun 13, 2023
1 parent b39f926 commit 3fbaa68
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/molecule/config.py
Expand Up @@ -182,7 +182,12 @@ def driver(self):
driver_name = self._get_driver_name()
driver = None

driver = api.drivers(config=self)[driver_name]
api_drivers = api.drivers(config=self)
if driver_name not in api_drivers:
msg = f"Failed to find driver {driver_name}. Please ensure that the driver is correctly installed."
util.sysexit_with_message(msg)

driver = api_drivers[driver_name]
driver.name = driver_name

return driver
Expand Down

0 comments on commit 3fbaa68

Please sign in to comment.