molecule: 3.6.0 login to podman fails '/usr/bin/env /bin/podman' No such file
Issue Type
- Bug report
Molecule and Ansible details
ansible --version
ansible [core 2.11.4]
config file = /home/indermue/src/ansible-mysql/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /root/python-venv/ansible-4.4.0/lib/python3.8/site-packages/ansible
ansible collection location = /home/indermue/src/ansible-mysql/collections:/root/python-venv/ansible-4.2.0/lib/python3.8/site-packages:/var/lib/awx/projects/ansible-mysql-manual/collections:/opt/my-tower-venv/ansible-4.2.0/lib/python3.8/site-packages
executable location = /root/python-venv/ansible-4.4.0/bin/ansible
python version = 3.8.8 (default, Aug 11 2021, 06:52:42) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]
jinja version = 3.0.1
libyaml = True
molecule --version
molecule 3.6.0 using python 3.8
ansible:2.11.4
delegated:3.6.0 from molecule
podman:1.1.0 from molecule_podman requiring collections: containers.podman>=1.7.0 ansible.posix>=1.3.0
Molecule installation method (one of):
- pip
Ansible installation method (one of):
- pip
Desired Behavior
molecule login -h node -s scenario
should open bash from within the podman container.
Actual Behaviour
Molecule fails to execute with the following error:
INFO Inventory /home/indermue/src/ansible-mysql/molecule/mariadb/inventory/static.yml linked to /root/.cache/molecule/ansible-mysql/mariadb/inventory/hosts
INFO Inventory /home/indermue/src/ansible-mysql/molecule/mariadb/inventory/group_vars linked to /root/.cache/molecule/ansible-mysql/mariadb/inventory/group_vars
INFO Inventory /home/indermue/src/ansible-mysql/molecule/mariadb/inventory/host_vars linked to /root/.cache/molecule/ansible-mysql/mariadb/inventory/host_vars
INFO Running mariadb > login
Traceback (most recent call last):
File "/root/python-venv/ansible-4.4.0/bin/molecule", line 8, in <module>
sys.exit(main())
File "/root/python-venv/ansible-4.4.0/lib/python3.8/site-packages/click/core.py", line 1137, in __call__
return self.main(*args, **kwargs)
File "/root/python-venv/ansible-4.4.0/lib/python3.8/site-packages/click/core.py", line 1062, in main
rv = self.invoke(ctx)
File "/root/python-venv/ansible-4.4.0/lib/python3.8/site-packages/click/core.py", line 1668, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/root/python-venv/ansible-4.4.0/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/root/python-venv/ansible-4.4.0/lib/python3.8/site-packages/click/core.py", line 763, in invoke
return __callback(*args, **kwargs)
File "/root/python-venv/ansible-4.4.0/lib/python3.8/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/root/python-venv/ansible-4.4.0/lib/python3.8/site-packages/molecule/command/login.py", line 166, in login
base.execute_subcommand(scenario.config, subcommand)
File "/root/python-venv/ansible-4.4.0/lib/python3.8/site-packages/molecule/command/base.py", line 149, in execute_subcommand
return command(config).execute()
File "/root/python-venv/ansible-4.4.0/lib/python3.8/site-packages/molecule/logger.py", line 188, in wrapper
rt = func(*args, **kwargs)
File "/root/python-venv/ansible-4.4.0/lib/python3.8/site-packages/molecule/command/login.py", line 101, in execute
self._get_login(hostname)
File "/root/python-venv/ansible-4.4.0/lib/python3.8/site-packages/molecule/command/login.py", line 146, in _get_login
app.runtime.exec(cmd)
File "/root/python-venv/ansible-4.4.0/lib/python3.8/site-packages/ansible_compat/runtime.py", line 138, in exec
result = run_func(
File "/usr/lib64/python3.8/subprocess.py", line 493, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/lib64/python3.8/subprocess.py", line 858, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib64/python3.8/subprocess.py", line 1706, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/env /bin/podman exec -e COLUMNS=254 -e LINES=60 -e TERM=bash -e TERM=xterm -ti mariadb_104 bash'
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 7
- Comments: 16 (7 by maintainers)
Commits related to this issue
- fix: allow to use stdin/out Fixes #3435 Use of ansible runtime prevents of use interactive stdin/stdout, and lack of split causing traces like this: FileNotFoundError: [Errno 2] No such file or dir... — committed to amarao/molecule by amarao 2 years ago
- fix: allow to use stdin/out Fixes #3435 Use of ansible runtime prevents of use interactive stdin/stdout, and lack of split causing traces like this: FileNotFoundError: [Errno 2] No such file or dir... — committed to amarao/molecule by amarao 2 years ago
I am having the same issue with the Docker driver:
I think that the problem is the type of
args
. I can reproduce with just this:If I change
args
to a list, it works properly:For some reason, when I try to patch this in
ansible_compat/runtime.py:138
, it just hangs:FYI
shlex.split()
would be more robust for argument splitting.Also in theory, you would have been able to keep the
app.runtime.exec()
and only needed to provide thetee=true
parameter. Unfortunately, there is a bug in thesubprocess_tee
library, that causes output to only printed on line breaks, so the revert to normal subprocess is correct for now.Downgrading to Molecule 3.5.2 works as expected
Same issue here but with docker. Verified 3.5.2 is working indeed. Running the command worked fine too so it must be an issue with the subprocess call.