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
The handling of TimeoutError exceptions in vsphere_file.py causes an additional exception:
Traceback (most recent call last):
File "/root/.ansible/tmp/ansible-tmp-1729501040.8020163-2149944-259712228090606/AnsiballZ_vsphere_file.py", line 107, in <module>
_ansiballz_main()
File "/root/.ansible/tmp/ansible-tmp-1729501040.8020163-2149944-259712228090606/AnsiballZ_vsphere_file.py", line 99, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/root/.ansible/tmp/ansible-tmp-1729501040.8020163-2149944-259712228090606/AnsiballZ_vsphere_file.py", line 47, in invoke_module
runpy.run_module(mod_name='ansible_collections.community.vmware.plugins.modules.vsphere_file', init_globals=dict(_module_fqn='ansible_collections.community.vmware.plugins.modules.vsphere_file', _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_community.vmware.vsphere_file_payload_03jc8ok7/ansible_community.vmware.vsphere_file_payload.zip/ansible_collections/community/vmware/plugins/modules/vsphere_file.py", line 350, in <module>
File "/tmp/ansible_community.vmware.vsphere_file_payload_03jc8ok7/ansible_community.vmware.vsphere_file_payload.zip/ansible_collections/community/vmware/plugins/modules/vsphere_file.py", line 199, in main
TypeError: 'TimeoutError' object is not subscriptable
The related source code in our (older) version is:
196 except HTTPError as e:
197 r = e
198 except socket.error as e:
199 module.fail_json(msg=to_native(e), errno=e[0], reason=to_native(e), **result)
200 except Exception as e:
201 module.fail_json(msg=to_native(e), errno=dir(e), reason=to_native(e), **result)
In the current code the lines are a little bit moved:
SUMMARY
The handling of
TimeoutError
exceptions invsphere_file.py
causes an additional exception:The related source code in our (older) version is:
In the current code the lines are a little bit moved:
community.vmware/plugins/modules/vsphere_file.py
Lines 172 to 182 in faf3cdf
It looks like a simple programming error in handling
OSError
exceptions:An untested solution could be:
Since Python 3.3 socket.error is an alias of OSError.
ISSUE TYPE
COMPONENT NAME
vsphere_file.py
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
see: summary
EXPECTED RESULTS
A detailed error message has been shown instead of the Python traceback.
see: summary
ACTUAL RESULTS
see: summary
The text was updated successfully, but these errors were encountered: