Skip to content

Commit

Permalink
docker: allow import docker in reset to fail
Browse files Browse the repository at this point in the history
* if the user hasn't installed the `[docker]` extra, they won't have
  `docker` to `import`, so don't make `import docker` required in the
  docker driver's `reset`.
* fixes #166
  • Loading branch information
guppy0130 committed Sep 18, 2024
1 parent 9943538 commit d03d44a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/molecule_plugins/docker/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,11 @@ def sanity_checks(self):
self._passed_sanity = True

def reset(self):
import docker
# TODO: maybe use self.sanity_check instead?
try:
import docker
except ImportError:
return

client = docker.from_env()
for c in client.containers.list(filters={"label": "owner=molecule"}):
Expand Down

0 comments on commit d03d44a

Please sign in to comment.