FileNotFoundError: [Errno 2] No such file or directory
pandalec opened this issue · 6 comments
SUMMARY
Cannot use vmware.vmware_rest
. Using this plugin results in a FileNotFoundError: [Errno 2] No such file or directory
. I tried the hints provided in FileNotFoundError when running modules #262
ISSUE TYPE
- Bug Report
COMPONENT NAME
vmware.vmware_rest
ANSIBLE VERSION
ansible [core 2.14.4]
config file = /home/panda/.ansible.cfg
configured module search path = ['/home/panda/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/panda/Git/project/venv/lib64/python3.11/site-packages/ansible
ansible collection location = /home/panda/.ansible/collections:/usr/share/ansible/collections
executable location = /home/panda/Git/project/venv/bin/ansible
python version = 3.11.2 (main, Feb 8 2023, 00:00:00) [GCC 12.2.1 20221121 (Red Hat 12.2.1-4)] (/home/panda/Git/project/venv/bin/python3)
jinja version = 3.1.2
libyaml = True
COLLECTION VERSION
# /home/panda/Git/project/venv/lib64/python3.11/site-packages/ansible_collections
Collection Version
----------------- -------
community.general 6.5.0
# /home/panda/Git/project/venv/lib/python3.11/site-packages/ansible_collections
Collection Version
----------------- -------
community.general 6.5.0
CONFIGURATION
CALLBACKS_ENABLED(/home/panda/.ansible.cfg) = ['profile_tasks']
CONFIG_FILE() = /home/panda/.ansible.cfg
HOST_KEY_CHECKING(/home/panda/.ansible.cfg) = False
OS / ENVIRONMENT
Fedora 37
Requirements:
wheel
ansible
pyvmomi<=v7.0.2
aiohttp
ansible-lint
pylint
autopep8
lxml
git+https://github.com/vmware/vsphere-automation-sdk-python.git
pyVim
STEPS TO REPRODUCE
Install vmware_rest:
ansible-galaxy collection install vmware.vmware_rest
Create playbook with the following task:
- name: Look up the Cluster in the inventory
register: search_result
vmware.vmware_rest.vcenter_cluster_info:
cluster: "Cluster"
delegate_to: localhost
EXPECTED RESULTS
I would expect that it shows clsuter info.
ACTUAL RESULTS
The full traceback is:
Traceback (most recent call last):
File "/home/panda/.ansible/tmp/ansible-tmp-1681997493.1066985-330989-221743039289391/AnsiballZ_vcenter_cluster_info.py", line 107, in <module>
_ansiballz_main()
File "/home/panda/.ansible/tmp/ansible-tmp-1681997493.1066985-330989-221743039289391/AnsiballZ_vcenter_cluster_info.py", line 99, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/home/panda/.ansible/tmp/ansible-tmp-1681997493.1066985-330989-221743039289391/AnsiballZ_vcenter_cluster_info.py", line 47, in invoke_module
runpy.run_module(mod_name='ansible_collections.vmware.vmware_rest.plugins.modules.vcenter_cluster_info', init_globals=dict(_module_fqn='ansible_collections.vmware.vmware_rest.plugins.modules.vcenter_cluster_info', _modlib_path=modlib_path),
File "<frozen runpy>", line 226, in run_module
File "<frozen runpy>", line 98, in _run_module_code
File "<frozen runpy>", line 88, in _run_code
File "/tmp/ansible_vmware.vmware_rest.vcenter_cluster_info_payload_mvbpv8h4/ansible_vmware.vmware_rest.vcenter_cluster_info_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_cluster_info.py", line 305, in <module>
File "/usr/lib64/python3.11/asyncio/base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/tmp/ansible_vmware.vmware_rest.vcenter_cluster_info_payload_mvbpv8h4/ansible_vmware.vmware_rest.vcenter_cluster_info_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_cluster_info.py", line 234, in main
File "/tmp/ansible_vmware.vmware_rest.vcenter_cluster_info_payload_mvbpv8h4/ansible_vmware.vmware_rest.vcenter_cluster_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py", line 119, in __init__
File "/tmp/ansible_vmware.vmware_rest.vcenter_cluster_info_payload_mvbpv8h4/ansible_vmware.vmware_rest.vcenter_cluster_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py", line 143, in run_on_daemon
File "/usr/lib64/python3.11/contextlib.py", line 137, in __enter__
return next(self.gen)
^^^^^^^^^^^^^^
File "/tmp/ansible_vmware.vmware_rest.vcenter_cluster_info_payload_mvbpv8h4/ansible_vmware.vmware_rest.vcenter_cluster_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/common.py", line 122, in connect
File "/tmp/ansible_vmware.vmware_rest.vcenter_cluster_info_payload_mvbpv8h4/ansible_vmware.vmware_rest.vcenter_cluster_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/common.py", line 54, in bind
FileNotFoundError: [Errno 2] No such file or directory
fatal: [dev-14-repository -> localhost]: FAILED! => {
"changed": false,
"module_stderr": "Traceback (most recent call last):\n File \"/home/panda/.ansible/tmp/ansible-tmp-1681997493.1066985-330989-221743039289391/AnsiballZ_vcenter_cluster_info.py\", line 107, in <module>\n _ansiballz_main()\n File \"/home/panda/.ansible/tmp/ansible-tmp-1681997493.1066985-330989-221743039289391/AnsiballZ_vcenter_cluster_info.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/panda/.ansible/tmp/ansible-tmp-1681997493.1066985-330989-221743039289391/AnsiballZ_vcenter_cluster_info.py\", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.vmware.vmware_rest.plugins.modules.vcenter_cluster_info', init_globals=dict(_module_fqn='ansible_collections.vmware.vmware_rest.plugins.modules.vcenter_cluster_info', _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_vmware.vmware_rest.vcenter_cluster_info_payload_mvbpv8h4/ansible_vmware.vmware_rest.vcenter_cluster_info_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_cluster_info.py\", line 305, in <module>\n File \"/usr/lib64/python3.11/asyncio/base_events.py\", line 653, in run_until_complete\n return future.result()\n ^^^^^^^^^^^^^^^\n File \"/tmp/ansible_vmware.vmware_rest.vcenter_cluster_info_payload_mvbpv8h4/ansible_vmware.vmware_rest.vcenter_cluster_info_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_cluster_info.py\", line 234, in main\n File \"/tmp/ansible_vmware.vmware_rest.vcenter_cluster_info_payload_mvbpv8h4/ansible_vmware.vmware_rest.vcenter_cluster_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py\", line 119, in __init__\n File \"/tmp/ansible_vmware.vmware_rest.vcenter_cluster_info_payload_mvbpv8h4/ansible_vmware.vmware_rest.vcenter_cluster_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py\", line 143, in run_on_daemon\n File \"/usr/lib64/python3.11/contextlib.py\", line 137, in __enter__\n return next(self.gen)\n ^^^^^^^^^^^^^^\n File \"/tmp/ansible_vmware.vmware_rest.vcenter_cluster_info_payload_mvbpv8h4/ansible_vmware.vmware_rest.vcenter_cluster_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/common.py\", line 122, in connect\n File \"/tmp/ansible_vmware.vmware_rest.vcenter_cluster_info_payload_mvbpv8h4/ansible_vmware.vmware_rest.vcenter_cluster_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/common.py\", line 54, in bind\nFileNotFoundError: [Errno 2] No such file or directory\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
Same issue but only with
{{ lookup('vmware.vmware_rest.datastore_moid', '{{ datastore_path }}') }}"
Tested with
cloud.common 2.0.4 and 2.1.3
error in cloud.common 2.0.4 :
Loading collection cloud.common from /ansible/collection/ansible_collections/cloud/common
exception during Jinja2 execution: Traceback (most recent call last):
File "/lib/python3.10/site-packages/ansible/template/__init__.py", line 831, in _lookup
ran = instance.run(loop_terms, variables=self._available_variables, **kwargs)
File "/ansible/collection/ansible_collections/cloud/common/plugins/plugin_utils/turbo/lookup.py", line 31, in run_on_daemon
return self.execute(terms=terms, variables=variables, **kwargs)
File "/ansible/collection/ansible_collections/cloud/common/plugins/plugin_utils/turbo/lookup.py", line 57, in execute
with ansible_collections.cloud.common.plugins.module_utils.turbo.common.connect(
File "/usr/local/lib/python3.10/contextlib.py", line 135, in __enter__
return next(self.gen)
File "/ansible/collection/ansible_collections/cloud/common/plugins/module_utils/turbo/common.py", line 95, in connect
turbo_socket.bind()
File "/ansible/collection/ansible_collections/cloud/common/plugins/module_utils/turbo/common.py", line 27, in bind
self._socket.connect(self._socket_path)
FileNotFoundError: [Errno 2] No such file or directory
fatal: [HIDEN]: FAILED! =>
msg: 'An unhandled exception occurred while running the lookup plugin ''vmware.vmware_rest.datastore_moid''. Error was a <class ''FileNotFoundError''>, original message: [Errno 2] No such file or directory. [Errno 2] No such file or directory'
Same issue with vmware.vmware_rest.vcenter_vm_power. As noted, stack trace indicates issue percolating from cloud.common.
Collection Version
cloud.common 2.1.3
vmware.vmware_rest 2.3.1
ansible [core 2.14.4]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.9/site-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.9.13 (main, Nov 9 2022, 13:16:24) [GCC 8.5.0 20210514 (Red Hat 8.5.0-15)] (/usr/bin/python3.9)
jinja version = 3.1.2
libyaml = True
The full traceback is:
Traceback (most recent call last):\r
File "/home/ansible/.ansible/tmp/ansible-tmp-1683301646.3150833-99-269542372869278/AnsiballZ_vcenter_vm_power.py", line 107, in \r
_ansiballz_main()\r
File "/home/ansible/.ansible/tmp/ansible-tmp-1683301646.3150833-99-269542372869278/AnsiballZ_vcenter_vm_power.py", line 99, in _ansiballz_main\r
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r
File "/home/ansible/.ansible/tmp/ansible-tmp-1683301646.3150833-99-269542372869278/AnsiballZ_vcenter_vm_power.py", line 48, in invoke_module\r
run_name='main', alter_sys=True)\r
File "/usr/lib64/python3.6/runpy.py", line 205, in run_module\r
return _run_module_code(code, init_globals, run_name, mod_spec)\r
File "/usr/lib64/python3.6/runpy.py", line 96, in _run_module_code\r
mod_name, mod_spec, pkg_name, script_name)\r
File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code\r
exec(code, run_globals)\r
File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_payload_x0qy8xte/ansible_vmware.vmware_rest.vcenter_vm_power_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vm_power.py", line 527, in \r
File "/usr/lib64/python3.6/asyncio/base_events.py", line 484, in run_until_complete\r
return future.result()\r
File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_payload_x0qy8xte/ansible_vmware.vmware_rest.vcenter_vm_power_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vm_power.py", line 379, in main\r
File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_payload_x0qy8xte/ansible_vmware.vmware_rest.vcenter_vm_power_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py", line 119, in init\r
File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_payload_x0qy8xte/ansible_vmware.vmware_rest.vcenter_vm_power_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py", line 144, in run_on_daemon\r
File "/usr/lib64/python3.6/contextlib.py", line 81, in enter\r
return next(self.gen)\r
File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_payload_x0qy8xte/ansible_vmware.vmware_rest.vcenter_vm_power_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/common.py", line 122, in connect\r
File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_payload_x0qy8xte/ansible_vmware.vmware_rest.vcenter_vm_power_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/common.py", line 54, in bind\r
FileNotFoundError: [Errno 2] No such file or directory\r
@pandalec @cbreuil-orange @idontevenreallycare
This issue occurred when the turbo daemon is not able to booted, therefore the socket is not created and when the client tried to connect it failed with 'FileNotFoundError'
Actually this can happen for many reasons, could you please try to run again the module using the cloud.common
version of this pull request ansible-collections/cloud.common#128 ?
Thanks