FS#78447 - [molecule-plugins] Vagrant driver not found

Attached to Project: Community Packages
Opened by Iisakki Jaakkola (Iizuki) - Tuesday, 09 May 2023, 06:39 GMT
Last edited by David Runge (dvzrv) - Wednesday, 10 May 2023, 09:23 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To David Runge (dvzrv)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:

Trying to use molecule with the vagrant driver fails.
Molecule immediately says that: "WARNING vagrant driver is not installed."
After which it fails for not being able to find some specific files/modules. Full output is below.

I believe it broke after I upgraded in 5.5.2023, so maybe it has something to do with the python 3.11 upgrade?

Additional info:
* package version(s)
* molecule-plugins 23.4.1-2
* molecule 5.0.0-2
* ansible 7.5.0-2
* ansible-core 2.14.5-1
* python-vagrant 1.0.0-3

Steps to reproduce:

Create a role with molecule & vagrant driver:
$ molecule init role --driver-name vagrant namespace.test

Try to create the instance:
$ cd test
$ molecule test

WARNING vagrant driver is not installed.
INFO update_config scenario test matrix: destroy
INFO Performing prerun with role_name_check=0...
INFO Set ANSIBLE_LIBRARY=/home/me/.cache/ansible-compat/fabdd6/modules:/home/me/.ansible/plugins/modules:/usr/share/ansible/plugins/modules
INFO Set ANSIBLE_COLLECTIONS_PATH=/home/me/.cache/ansible-compat/fabdd6/collections:/home/me/.ansible/collections:/usr/share/ansible/collections
INFO Set ANSIBLE_ROLES_PATH=/home/me/.cache/ansible-compat/fabdd6/roles:/home/me/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/home/me/Ansible/roles
INFO Running update_config > destroy

PLAY [Destroy] *****************************************************************

TASK [Destroy molecule instance(s)] ********************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'ansible.module_utils.common.yaml'
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/home/me/.ansible/tmp/ansible-tmp-1683609218.862559-12932-35868640957978/AnsiballZ_vagrant.py\", line 107, in <module>\n _ansiballz_main()\n File \"/home/me/.ansible/tmp/ansible-tmp-1683609218.862559-12932-35868640957978/AnsiballZ_vagrant.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/me/.ansible/tmp/ansible-tmp-1683609218.862559-12932-35868640957978/AnsiballZ_vagrant.py\", line 47, in invoke_module\n runpy.run_module(mod_name='ansible.modules.vagrant', init_globals=dict(_module_fqn='ansible.modules.vagrant', _modlib_path=modlib_path),\n File \"<frozen runpy>\", line 226, in run_module\n File \"<frozen runpy>\", line 98, in _run_module_code\n File \"<frozen runpy>\", line 88, in _run_code\n File \"/tmp/ansible_vagrant_payload_mhfiavsb/ansible_vagrant_payload.zip/ansible/modules/vagrant.py\", line 33, in <module>\n File \"/usr/lib/python3.11/site-packages/molecule/util.py\", line 40, in <module>\n from molecule.app import app\n File \"/usr/lib/python3.11/site-packages/molecule/app.py\", line 13, in <module>\n app = App()\n ^^^^^\n File \"/usr/lib/python3.11/site-packages/molecule/app.py\", line 10, in __init__\n self.runtime = Runtime(isolated=True)\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/lib/python3.11/site-packages/ansible_compat/runtime.py\", line 115, in __init__\n from ansible.utils.display import Display\n File \"/usr/lib/python3.11/site-packages/ansible/utils/display.py\", line 36, in <module>\n from ansible import constants as C\n File \"/usr/lib/python3.11/site-packages/ansible/constants.py\", line 12, in <module>\n from ansible.config.manager import ConfigManager\n File \"/usr/lib/python3.11/site-packages/ansible/config/manager.py\", line 22, in <module>\n from ansible.module_utils.common.yaml import yaml_load\nModuleNotFoundError: No module named 'ansible.module_utils.common.yaml'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

PLAY RECAP *********************************************************************
localhost : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
This task depends upon

Closed by  David Runge (dvzrv)
Wednesday, 10 May 2023, 09:23 GMT
Reason for closing:  Fixed
Additional comments about closing:  Fixed with molecule-plugins 23.4.1-3
Comment by David Runge (dvzrv) - Wednesday, 10 May 2023, 08:43 GMT
@Iizuki: thanks for the ticket.

This is an upstream issue as they have probably broken even more things with their latest YOLO ansible-compat release (see [1-3]).
Feel free to shout into the void there (I doubt the common maintainer of all these projects cares though).
I'm currently unsure which version works with which anymore.

Your specific issue seems to be with `No module named 'ansible.module_utils.common.yaml'` though. It might even be unrelated, who knows. Either way: please report upstream.

[1] https://github.com/ansible-community/molecule/issues/3903
[2] https://github.com/ansible/ansible-lint/issues/3393
[3] https://github.com/ansible/ansible-lint/issues/3408
Comment by David Runge (dvzrv) - Wednesday, 10 May 2023, 08:45 GMT
FWIW, this seems related: https://github.com/ansible-community/molecule-plugins/pull/142

If you could try applying those changes and report back, that'd be ace!
Comment by David Runge (dvzrv) - Wednesday, 10 May 2023, 09:23 GMT
That PR indeed fixes this issue. Will apply and bump.

Loading...