You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
molecule 6.0.2 using python 3.11
ansible:2.15.1
default:6.0.2 from molecule
Linux wsl 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 GNU/Linux
Ubuntu 22.04.2 LTS
What happened
Running molecule reset can delete the entire project. The role is in a collection and I think the issue is it tries to install the same collection from GitLab using ansible-galaxy, since my collections path is the same as my development path it overwrites my project. I've been using this same setup for years and this did not happen with previous versions of Molecule.
I am actively developing the collection so it is expected that I might need to run them. When I run them they need to be on the collections path.
If I edit my ansible.cfg and comment out the collections_path, it works correctly:
molecule reset
WARNING The scenario config file ('/home/ansible/ansible/development/collections/ansible_collections/nats/default/roles/aide/molecule/default/molecule.yml') has been modified since the scenario was created. If recent changes are important, reset the scenario with 'molecule destroy' to clean up created items or 'molecule reset' to clear current configuration.
INFO default scenario test matrix:
INFO Performing prerun with role_name_check=0...
INFO Running from /home/ansible/ansible/development/collections/ansible_collections/nats/default/roles/aide : ansible-galaxy collection install -vvv --force ../..
INFO Removing /home/ansible/.cache/molecule/aide/default
I could probably work around it by using a shell function or alias but I don't want to have to rely on a workaround.
Reproducing example
To reproduce ensure your COLLECTIONS_PATHS contains the role that you are running molecule on and do `molecule reset` in any role.For example:
ansible-config dump
...
COLLECTIONS_PATHS(/home/ansible/ansible/development/ansible.cfg) = ['/home/ansible/ansible/development/collections']
...
# Change into a role that is under COLLECTIONS_PATHS and run molecule resetcd /home/ansible/ansible/development/collections/my/ns/roles/myrolemolecule resetWARNING The scenario config file ('/home/ansible/ansible/development/collections/ansible_collections/nats/default/molecule/default/molecule.yml') has been modified since the scenario was created. If recent changes are important, reset the scenario with 'molecule destroy' to clean up created items or 'molecule reset' to clear current configuration.INFO default scenario test matrix:
INFO Performing prerun with role_name_check=0...INFO Set ANSIBLE_LIBRARY=plugins/modules:/home/ansible/.ansible/plugins/modules:/usr/share/ansible/plugins/modulesINFO Set ANSIBLE_ROLES_PATH=roles:/home/ansible/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/rolesINFO Provisioning collection ansible.posix:>=1.4.0 from galaxy.ymlINFO Running from /home/ansible/ansible/development/collections/ansible_collections/nats/default : ansible-galaxy collection install -vvv ansible.posix:>=1.4.0INFO Provisioning collection community.general:>=5.0.2 from galaxy.ymlINFO Running from /home/ansible/ansible/development/collections/ansible_collections/nats/default : ansible-galaxy collection install -vvv community.general:>=5.0.2INFO Provisioning collection community.crypto:>=2.3.2 from galaxy.ymlINFO Running from /home/ansible/ansible/development/collections/ansible_collections/nats/default : ansible-galaxy collection install -vvv community.crypto:>=2.3.2INFO Running from /home/ansible/ansible/development/collections/ansible_collections/nats/default : ansible-galaxy collection install -vvv --force /home/ansible/ansible/development/collections/ansible_collections/nats/defaultWARNING Retrying execution failure 250 of: ansible-galaxy collection install -vvv --force /home/ansible/ansible/development/collections/ansible_collections/nats/defaultERROR Command returned 250 code:
Starting galaxy collection install processProcess install dependency mapStarting collection install processInstalling 'nats.default:1.1.3' to '/home/ansible/ansible/development/collections/ansible_collections/nats/default'the full traceback was:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/ansible/cli/__init__.py", line 659, in cli_executorexit_code = cli.run()^^^^^^^^^File "/usr/local/lib/python3.11/site-packages/ansible/cli/galaxy.py", line 715, in runreturn context.CLIARGS['func']()^^^^^^^^^^^^^^^^^^^^^^^^^File "/usr/local/lib/python3.11/site-packages/ansible/cli/galaxy.py", line 117, in method_wrapperreturn wrapped_method(*args, **kwargs)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "/usr/local/lib/python3.11/site-packages/ansible/cli/galaxy.py", line 1369, in execute_installself._execute_install_collection(File "/usr/local/lib/python3.11/site-packages/ansible/cli/galaxy.py", line 1406, in _execute_install_collectioninstall_collections(File "/usr/local/lib/python3.11/site-packages/ansible/galaxy/collection/__init__.py", line 769, in install_collectionsinstall(concrete_coll_pin, output_path, artifacts_manager)File "/usr/local/lib/python3.11/site-packages/ansible/galaxy/collection/__init__.py", line 1494, in installinstall_src(collection, b_artifact_path, b_collection_path, artifacts_manager)File "/usr/local/lib/python3.11/site-packages/ansible/galaxy/collection/__init__.py", line 1623, in install_srcfile_manifest = _build_files_manifest(^^^^^^^^^^^^^^^^^^^^^^File "/usr/local/lib/python3.11/site-packages/ansible/galaxy/collection/__init__.py", line 1078, in _build_files_manifestreturn _build_files_manifest_walk(b_collection_path, namespace, name, ignore_patterns)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "/usr/local/lib/python3.11/site-packages/ansible/galaxy/collection/__init__.py", line 1245, in _build_files_manifest_walk_walk(b_collection_path, b_collection_path)File "/usr/local/lib/python3.11/site-packages/ansible/galaxy/collection/__init__.py", line 1205, in _walkfor b_item in os.listdir(b_path):
^^^^^^^^^^^^^^^^^^FileNotFoundError: [Errno 2] No such file or directory: b'/home/ansible/ansible/development/collections/ansible_collections/nats/default'ansible-galaxyconfig file = /home/ansible/ansible/development/ansible.cfgconfigured module search path = ['/home/ansible/ansible/development/collections/ansible_collections/nats/default/plugins/modules', '/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']ansible python module location = /usr/local/lib/python3.11/site-packages/ansibleansible collection location = /home/ansible/ansible/development/collections:/usr/local/lib/python3.11/site-packagesexecutable location = /usr/local/bin/ansible-galaxypython version = 3.11.4 (main, Aug 16 2023, 05:31:52) [GCC 10.2.1 20210110] (/usr/local/bin/python3)jinja version = 3.1.2libyaml = TrueUsing /home/ansible/ansible/development/ansible.cfg as config fileFound installed collection ansible.posix:1.5.4 at '/home/ansible/ansible/development/collections/ansible_collections/ansible/posix'Found installed collection community.general:7.1.0 at '/home/ansible/ansible/development/collections/ansible_collections/community/general'Found installed collection nats.default:1.1.3 at '/home/ansible/ansible/development/collections/ansible_collections/nats/default'Found installed collection community.crypto:2.14.0 at '/home/ansible/ansible/development/collections/ansible_collections/community/crypto'ERROR! Unexpected Exception, this is probably a bug: [Errno 2] No such file or directory: b'/home/ansible/ansible/development/collections/ansible_collections/nats/default'Traceback (most recent call last):
File "/usr/local/bin/molecule", line 8, in <module>sys.exit(main())^^^^^^File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1157, in __call__return self.main(*args, **kwargs)^^^^^^^^^^^^^^^^^^^^^^^^^^File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1078, in mainrv = self.invoke(ctx)^^^^^^^^^^^^^^^^File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1688, in invokereturn _process_result(sub_ctx.command.invoke(sub_ctx))^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1434, in invokereturn ctx.invoke(self.callback, **ctx.params)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "/usr/local/lib/python3.11/site-packages/click/core.py", line 783, in invokereturn __callback(*args, **kwargs)^^^^^^^^^^^^^^^^^^^^^^^^^^^File "/usr/local/lib/python3.11/site-packages/click/decorators.py", line 33, in new_funcreturn f(get_current_context(), *args, **kwargs)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "/usr/local/lib/python3.11/site-packages/molecule/command/reset.py", line 46, in resetbase.execute_cmdline_scenarios(scenario_name, args, command_args)File "/usr/local/lib/python3.11/site-packages/molecule/command/base.py", line 113, in execute_cmdline_scenariosscenario.config.runtime.prepare_environment(File "/usr/local/lib/python3.11/site-packages/ansible_compat/runtime.py", line 653, in prepare_environmentself.install_collection_from_disk(File "/usr/local/lib/python3.11/site-packages/ansible_compat/runtime.py", line 476, in install_collection_from_diskself.install_collection(path, destination=destination, force=True)File "/usr/local/lib/python3.11/site-packages/ansible_compat/runtime.py", line 467, in install_collectionraise InvalidPrerequisiteError(msg)ansible_compat.errors.InvalidPrerequisiteError: Command returned 250 code:Starting galaxy collection install processProcess install dependency mapStarting collection install processInstalling 'nats.default:1.1.3' to '/home/ansible/ansible/development/collections/ansible_collections/nats/default'the full traceback was:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/ansible/cli/__init__.py", line 659, in cli_executorexit_code = cli.run()^^^^^^^^^File "/usr/local/lib/python3.11/site-packages/ansible/cli/galaxy.py", line 715, in runreturn context.CLIARGS['func']()^^^^^^^^^^^^^^^^^^^^^^^^^File "/usr/local/lib/python3.11/site-packages/ansible/cli/galaxy.py", line 117, in method_wrapperreturn wrapped_method(*args, **kwargs)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "/usr/local/lib/python3.11/site-packages/ansible/cli/galaxy.py", line 1369, in execute_installself._execute_install_collection(File "/usr/local/lib/python3.11/site-packages/ansible/cli/galaxy.py", line 1406, in _execute_install_collectioninstall_collections(File "/usr/local/lib/python3.11/site-packages/ansible/galaxy/collection/__init__.py", line 769, in install_collectionsinstall(concrete_coll_pin, output_path, artifacts_manager)File "/usr/local/lib/python3.11/site-packages/ansible/galaxy/collection/__init__.py", line 1494, in installinstall_src(collection, b_artifact_path, b_collection_path, artifacts_manager)File "/usr/local/lib/python3.11/site-packages/ansible/galaxy/collection/__init__.py", line 1623, in install_srcfile_manifest = _build_files_manifest(^^^^^^^^^^^^^^^^^^^^^^File "/usr/local/lib/python3.11/site-packages/ansible/galaxy/collection/__init__.py", line 1078, in _build_files_manifestreturn _build_files_manifest_walk(b_collection_path, namespace, name, ignore_patterns)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "/usr/local/lib/python3.11/site-packages/ansible/galaxy/collection/__init__.py", line 1245, in _build_files_manifest_walk_walk(b_collection_path, b_collection_path)File "/usr/local/lib/python3.11/site-packages/ansible/galaxy/collection/__init__.py", line 1205, in _walkfor b_item in os.listdir(b_path):
^^^^^^^^^^^^^^^^^^FileNotFoundError: [Errno 2] No such file or directory: b'/home/ansible/ansible/development/collections/ansible_collections/nats/default'ansible-galaxy [core 2.15.1]config file = /home/ansible/ansible/development/ansible.cfgconfigured module search path = ['/home/ansible/ansible/development/collections/ansible_collections/nats/default/plugins/modules', '/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']ansible python module location = /usr/local/lib/python3.11/site-packages/ansibleansible collection location = /home/ansible/ansible/development/collections:/usr/local/lib/python3.11/site-packagesexecutable location = /usr/local/bin/ansible-galaxypython version = 3.11.4 (main, Aug 16 2023, 05:31:52) [GCC 10.2.1 20210110] (/usr/local/bin/python3)jinja version = 3.1.2libyaml = TrueUsing /home/ansible/ansible/development/ansible.cfg as config fileFound installed collection ansible.posix:1.5.4 at '/home/ansible/ansible/development/collections/ansible_collections/ansible/posix'Found installed collection community.general:7.1.0 at '/home/ansible/ansible/development/collections/ansible_collections/community/general'Found installed collection nats.default:1.1.3 at '/home/ansible/ansible/development/collections/ansible_collections/nats/default'Found installed collection community.crypto:2.14.0 at '/home/ansible/ansible/development/collections/ansible_collections/community/crypto'ERROR! Unexpected Exception, this is probably a bug: [Errno 2] No such file or directory: b'/home/ansible/ansible/development/collections/ansible_collections/nats/default'
I've lost all of my uncommitted changes.
The text was updated successfully, but these errors were encountered:
It happened to me too yesterday when running molecule test. Sounds similar enough.
I was running "molecule test" but had ANSIBLE_COLLECTIONS_PATH=../../.. in my environment which I find sometimes necessary. Not sure if this should be another issue. However, not much more to say about it.
I had the same problem today running molecule test with my collection inside ANSIBLE_COLLECTIONS_PATH. After that, there were two files in my collection named FILES.json and MANIFEST.json. All other files were gone.
I think this is caused by #3962. One user even commented that the changes in this pull request will cause problems.
I can't believe this is still a problem since 2023, even worse I fell into it again yesterday and lost all of the work I had not yet committed. Please someone fix this, or at least provide some sort of confirmation prompt before deleting all my work.
Prerequisites
pip check
does not report any conflictsEnvironment
molecule 6.0.2 using python 3.11
ansible:2.15.1
default:6.0.2 from molecule
Linux wsl 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 GNU/Linux
Ubuntu 22.04.2 LTS
What happened
Running molecule reset can delete the entire project. The role is in a collection and I think the issue is it tries to install the same collection from GitLab using ansible-galaxy, since my collections path is the same as my development path it overwrites my project. I've been using this same setup for years and this did not happen with previous versions of Molecule.
I am actively developing the collection so it is expected that I might need to run them. When I run them they need to be on the collections path.
If I edit my ansible.cfg and comment out the collections_path, it works correctly:
I could probably work around it by using a shell function or alias but I don't want to have to rely on a workaround.
Reproducing example
I've lost all of my uncommitted changes.
The text was updated successfully, but these errors were encountered: