Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v25.1.0 cant find docker driver #4372

Closed
7 tasks done
Doumor opened this issue Jan 21, 2025 · 12 comments · Fixed by ansible-community/molecule-plugins#294
Closed
7 tasks done

v25.1.0 cant find docker driver #4372

Doumor opened this issue Jan 21, 2025 · 12 comments · Fixed by ansible-community/molecule-plugins#294

Comments

@Doumor
Copy link

Doumor commented Jan 21, 2025

Prerequisites

  • This was not already reported in the past (duplicate check)
  • It does reproduce it with code from main branch (latest unreleased version)
  • I include a minimal example for reproducing the bug
  • The bug is not trivial, as for those a direct pull-request is preferred
  • Running pip check does not report any conflicts
  • I was able to reproduce the issue on a different machine
  • The issue is not specific to any driver other than 'default' one

Environment

v25.1.0

(cannot get output, GH workflow)

What happened

Failed to load driver entry point Traceback (most recent call last):
  File "/home/runner/micromamba/envs/ansible-ufw/lib/python3.12/site-packages/molecule/api.py", line 47, in drivers
    pm.load_setuptools_entrypoints("molecule.driver")
  File "/home/runner/micromamba/envs/ansible-ufw/lib/python3.12/site-packages/pluggy/_manager.py", line 421, in load_setuptools_entrypoints
    plugin = ep.load()
             ^^^^^^^^^
  File "/home/runner/micromamba/envs/ansible-ufw/lib/python3.12/importlib/metadata/__init__.py", line 205, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/micromamba/envs/ansible-ufw/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 999, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/runner/micromamba/envs/ansible-ufw/lib/python3.12/site-packages/molecule_plugins/containers/driver.py", line 23, in <module>
    from molecule_plugins.podman.driver import Podman as DriverBackend
  File "/home/runner/micromamba/envs/ansible-ufw/lib/python3.12/site-packages/molecule_plugins/podman/driver.py", line 33, in <module>
    from molecule.util import run_command, sysexit_with_message
ImportError: cannot import name 'run_command' from 'molecule.util' (/home/runner/micromamba/envs/ansible-ufw/lib/python3.12/site-packages/molecule/util.py)

ERROR    Failed to load driver entry point Traceback (most recent call last):
  File "/home/runner/micromamba/envs/ansible-ufw/lib/python3.12/site-packages/molecule/api.py", line 47, in drivers
    pm.load_setuptools_entrypoints("molecule.driver")
  File "/home/runner/micromamba/envs/ansible-ufw/lib/python3.12/site-packages/pluggy/_manager.py", line 421, in load_setuptools_entrypoints
    plugin = ep.load()
             ^^^^^^^^^
  File "/home/runner/micromamba/envs/ansible-ufw/lib/python3.12/importlib/metadata/__init__.py", line 205, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/micromamba/envs/ansible-ufw/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name, package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 999, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/runner/micromamba/envs/ansible-ufw/lib/python3.12/site-packages/molecule_plugins/containers/driver.py", line 23, in <module>
    from molecule_plugins.podman.driver import Podman as DriverBackend
  File "/home/runner/micromamba/envs/ansible-ufw/lib/python3.12/site-packages/molecule_plugins/podman/driver.py", line 33, in <module>
    from molecule.util import run_command, sysexit_with_message
ImportError: cannot import name 'run_command' from 'molecule.util' (/home/runner/micromamba/envs/ansible-ufw/lib/python3.12/site-packages/molecule/util.py)

CRITICAL Failed to find driver docker. Please ensure that the driver is correctly installed.
Error: Process completed with exit code 1.

Reproducing example

Install molecule v25.1.0 and try run molecule test.

Example GH workflow:

      - uses: actions/checkout@v4

      - uses: mamba-org/setup-micromamba@v1
        with:
          micromamba-version: '1.5.8-0'
          environment-file: environment.ci.yml
          init-shell: bash
          post-cleanup: 'all'

      - name: Run Molecule tests
        run: molecule test
        shell: micromamba-shell {0}
        env:
          PY_COLORS: '1'
          ANSIBLE_FORCE_COLOR: '1'
          MOLECULE_DISTRO: ${{ matrix.distro }}


env files:

---
name: ansible-ufw
channels:
  - conda-forge
dependencies:
  - python~=3.12.0
  - pip>=22.2
  - pip:
      - -r requirements.txt
      - -r requirements.ci.txt



ansible-lint
molecule
molecule-plugins[docker]
docker
requests==2.31.0  # pinned to the latest version not breaking Docker SDK
yamllint
@corvus-migratorius
Copy link

Same here, pretty much, except I've reproduced this with the latest micromamba release (2.0.5-0), so this doesn't seem to be related to the way micromamba deploys molecule... Also, reproduced on ubuntu2004, ubuntu2204 and ubuntu2404 GithubActions images.

@apatard
Copy link
Contributor

apatard commented Jan 21, 2025

it's probably due to #4359. Either it's handled on molecule side or we'll have to try importing a local copy of run_command into the plugins (as long as it's technically possible, I don't remember if there's a common code in the plugins ...)

@jsf9k
Copy link
Contributor

jsf9k commented Jan 21, 2025

This is breaking my Molecule testing workflows too, starting today. See, for instance, here.

@Nebucatnetzer
Copy link

Same issue with podman.

@apatard
Copy link
Contributor

apatard commented Jan 22, 2025

some more thoughts about what I've said yesterday: the change by itself on molecule side seems simple and logical. I think the right place to fix this issue is in the plugins. I'll try to open a PR to fix the plugins asap.

Can someone please open a bug on the -plugins as the issue is there ?

hswong3i added a commit to alvistack/ansible-community-molecule-plugins that referenced this issue Jan 22, 2025

Verified

This commit was signed with the committer’s verified signature. The key has expired.
hswong3i Wong Hoi Sing Edison
From ansible/molecule#4359 `util.run_command`
should now replaced with `app.run_command`.

Fixes ansible/molecule#4372

Signed-off-by: Wong Hoi Sing Edison <[email protected]>
@g3n35i5 g3n35i5 marked this as a duplicate of #4374 Jan 22, 2025
hswong3i added a commit to alvistack/ansible-community-molecule-plugins that referenced this issue Jan 22, 2025

Verified

This commit was signed with the committer’s verified signature. The key has expired.
hswong3i Wong Hoi Sing Edison
From ansible/molecule#4359 `util.run_command`
should now replaced with `app.run_command`.

Fixes ansible/molecule#4372

Signed-off-by: Wong Hoi Sing Edison <[email protected]>
@Qalthos Qalthos removed the new label Jan 22, 2025
hswong3i added a commit to alvistack/ansible-community-molecule-plugins that referenced this issue Jan 22, 2025

Verified

This commit was signed with the committer’s verified signature. The key has expired.
hswong3i Wong Hoi Sing Edison
From ansible/molecule#4359 `util.run_command`
should now replaced with `app.run_command`.

Fixes ansible/molecule#4372

Signed-off-by: Wong Hoi Sing Edison <[email protected]>
hswong3i added a commit to alvistack/ansible-community-molecule-plugins that referenced this issue Jan 22, 2025

Verified

This commit was signed with the committer’s verified signature. The key has expired.
hswong3i Wong Hoi Sing Edison
…n_command()

From ansible/molecule#4359 `util.run_command()`
should now replaced with `get_app(Path()).run_command()`.

Fixes ansible/molecule#4372

Signed-off-by: Wong Hoi Sing Edison <[email protected]>
@isuftin
Copy link

isuftin commented Jan 22, 2025

Piling on, this also kills the EC2 plugin

Failed to load driver entry point Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/molecule/api.py", line 47, in drivers
    pm.load_setuptools_entrypoints("molecule.driver")
  File "/usr/local/lib/python3.11/site-packages/pluggy/_manager.py", line 421, in load_setuptools_entrypoints
    plugin = ep.load()
             ^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/metadata/__init__.py", line 202, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/local/lib/python3.11/site-packages/molecule_plugins/containers/driver.py", line 23, in <module>
    from molecule_plugins.podman.driver import Podman as DriverBackend
  File "/usr/local/lib/python3.11/site-packages/molecule_plugins/podman/driver.py", line 33, in <module>
    from molecule.util import run_command, sysexit_with_message
ImportError: cannot import name 'run_command' from 'molecule.util' (/usr/local/lib/python3.11/site-packages/molecule/util.py)
INFO     Found config file /builds/ctek/automation/ansible/playbooks/base_operating_system/.config/molecule/config.yml
ERROR    Failed to load driver entry point Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/molecule/api.py", line 47, in drivers
    pm.load_setuptools_entrypoints("molecule.driver")
  File "/usr/local/lib/python3.11/site-packages/pluggy/_manager.py", line 421, in load_setuptools_entrypoints
    plugin = ep.load()
             ^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/metadata/__init__.py", line 202, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name, package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/local/lib/python3.11/site-packages/molecule_plugins/containers/driver.py", line 23, in <module>
    from molecule_plugins.podman.driver import Podman as DriverBackend
  File "/usr/local/lib/python3.11/site-packages/molecule_plugins/podman/driver.py", line 33, in <module>
    from molecule.util import run_command, sysexit_with_message
ImportError: cannot import name 'run_command' from 'molecule.util' (/usr/local/lib/python3.11/site-packages/molecule/util.py)
CRITICAL Failed to find driver ec2. Please ensure that the driver is correctly installed.

@hswong3i
Copy link
Contributor

Please try with ansible-community/molecule-plugins#294

I had merge the changes to my OBS package https://build.opensuse.org/package/show/home:alvistack/ansible-community-molecule-plugins-23.6.0, able to run molecule v25.1.0 with podman and vagrant driver correctly.

apatard pushed a commit to ansible-community/molecule-plugins that referenced this issue Jan 22, 2025
…n_command()

From ansible/molecule#4359 `util.run_command()`
should now replaced with `get_app(Path()).run_command()`.

Fixes ansible/molecule#4372

Signed-off-by: Wong Hoi Sing Edison <[email protected]>
corvus-migratorius added a commit to corvus-migratorius/ansible-role-template that referenced this issue Jan 23, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Prompted by what we discovered in ansible/molecule#4372

Pinning the currently working version of Molecule and Docker SDK.
@apatard
Copy link
Contributor

apatard commented Jan 23, 2025

I've made a release of the -plugins with @hswong3i 's fix today, so it should work again now.

@jsf9k
Copy link
Contributor

jsf9k commented Jan 23, 2025

I confirmed that it's working again for me.

@ssbarnea
Copy link
Member

It would be better to pin down molecule to previous version until we finish a set of major changes related to https://ansible.readthedocs.io/projects/dev-tools/user-guide/test-isolation/

@ssbarnea
Copy link
Member

@Doumor Can you please update molecule and ansible-compat to latest and check if you still have the problem?

@ssbarnea
Copy link
Member

I am closing this as if its a problem is likely to be with https://github.com/ansible-community/molecule-plugins package, which might need update work with current version of molecule.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
9 participants