-
Notifications
You must be signed in to change notification settings - Fork 67
Open
Labels
Description
Summary
Attempting to push a VM into the content library, met with 'KeyError: "value"' messages. Was able to get an actual message by editing vmware/vmware_rest/plugins/module_utils/vmware_rest.py through trial and error
Issue Type
Bug Report
Component Name
vcenter_vmtemplate_libraryitems
Ansible Version
ansible-playbook [core 2.15.13]
config file = /home/user/ansible_playbooks/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /env/lib64/python3.9/site-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /env/bin/ansible-playbook
python version = 3.9.18 (main, Jan 24 2024, 00:00:00) [GCC 11.4.1 20231218 (Red Hat 11.4.1-3)] (/usr/sx/looks-app/env/bin/python3)
jinja version = 3.1.6
libyaml = TrueCollection Versions
community.vmware 3.11.1
vmware.vmware_rest 2.3.1
vmware.vmware_rest 4.9.0 Configuration
$ ansible-config dump --only-changed
OS / Environment
Centos 9
Steps to Reproduce
User should not have permission to create library items during this test.
- name: Deploy
vmware.vmware_rest.vcenter_vmtemplate_libraryitems:
name: "test-item"
source_vm: "test-item"
vcenter_hostname: "{{ vsphere_server }}"
vcenter_username: "{{ vsphere_user }}"
vcenter_password: "{{ vsphere_password }}"
library: "{{ src_library }}"
placement:
cluster: "{{ cluster }}"
folder: "{{ '/{{ datacenter }}/vm' }}"
state: presentExpected Results
Expected a better error message.
I had to modify the vmware/vmware_rest/plugins/module_utils/vmware_rest.py file, around line 292, and add a check, and spit out the device_list blob in order to get the actual error message.
Actual Results
TASK [Deploy] *******************************************************************************************************************************************************************************************************************************************************[808/27795]
task path: /home/user/ansible_playbooks/test.yaml:22
The full traceback is:
Traceback (most recent call last):
File "<stdin>", line 107, in <module>
File "<stdin>", line 99, in _ansiballz_main
File "<stdin>", line 47, in invoke_module
File "/usr/lib64/python3.9/runpy.py", line 225, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/usr/lib64/python3.9/runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/usr/lib64/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/tmp/ansible_vmware.vmware_rest.vcenter_vmtemplate_libraryitems_payload_y3uh7acv/ansible_vmware.vmware_rest.vcenter_vmtemplate_libraryitems_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vmtemplate_libraryitems.py", line 695, in <module
>
File "/usr/lib64/python3.9/asyncio/base_events.py", line 647, in run_until_complete
return future.result()
File "/tmp/ansible_vmware.vmware_rest.vcenter_vmtemplate_libraryitems_payload_y3uh7acv/ansible_vmware.vmware_rest.vcenter_vmtemplate_libraryitems_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vmtemplate_libraryitems.py", line 562, in main
File "/tmp/ansible_vmware.vmware_rest.vcenter_vmtemplate_libraryitems_payload_y3uh7acv/ansible_vmware.vmware_rest.vcenter_vmtemplate_libraryitems_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vmtemplate_libraryitems.py", line 587, in entry_p
oint
File "/tmp/ansible_vmware.vmware_rest.vcenter_vmtemplate_libraryitems_payload_y3uh7acv/ansible_vmware.vmware_rest.vcenter_vmtemplate_libraryitems_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vmtemplate_libraryitems.py", line 607, in _create
File "/tmp/ansible_vmware.vmware_rest.vcenter_vmtemplate_libraryitems_payload_y3uh7acv/ansible_vmware.vmware_rest.vcenter_vmtemplate_libraryitems_payload.zip/ansible_collections/vmware/vmware_rest/plugins/module_utils/vmware_rest.py", line 364, in exists
File "/tmp/ansible_vmware.vmware_rest.vcenter_vmtemplate_libraryitems_payload_y3uh7acv/ansible_vmware.vmware_rest.vcenter_vmtemplate_libraryitems_payload.zip/ansible_collections/vmware/vmware_rest/plugins/module_utils/vmware_rest.py", line 292, in build_full_device_list
KeyError: 'value'
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f1a95366400>
Unclosed connector
connections: ['deque([(<aiohttp.client_proto.ResponseHandler object at 0x7f1a93f459a0>, 33884708.65422101)])']
connector: <aiohttp.connector.TCPConnector object at 0x7f1a95366310>
fatal: [localhost]: FAILED! => changed=false
module_stderr: |-
Traceback (most recent call last):
File "<stdin>", line 107, in <module>
File "<stdin>", line 99, in _ansiballz_main
File "<stdin>", line 47, in invoke_module
File "/usr/lib64/python3.9/runpy.py", line 225, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/usr/lib64/python3.9/runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/usr/lib64/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/tmp/ansible_vmware.vmware_rest.vcenter_vmtemplate_libraryitems_payload_y3uh7acv/ansible_vmware.vmware_rest.vcenter_vmtemplate_libraryitems_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vmtemplate_libraryitems.py", line 695, in <mo
dule>
File "/usr/lib64/python3.9/asyncio/base_events.py", line 647, in run_until_complete
return future.result()
File "/tmp/ansible_vmware.vmware_rest.vcenter_vmtemplate_libraryitems_payload_y3uh7acv/ansible_vmware.vmware_rest.vcenter_vmtemplate_libraryitems_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vmtemplate_libraryitems.py", line 562, in mai
n
File "/tmp/ansible_vmware.vmware_rest.vcenter_vmtemplate_libraryitems_payload_y3uh7acv/ansible_vmware.vmware_rest.vcenter_vmtemplate_libraryitems_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vmtemplate_libraryitems.py", line 587, in ent
ry_point
File "/tmp/ansible_vmware.vmware_rest.vcenter_vmtemplate_libraryitems_payload_y3uh7acv/ansible_vmware.vmware_rest.vcenter_vmtemplate_libraryitems_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vmtemplate_libraryitems.py", line 607, in _cr
eate
File "/tmp/ansible_vmware.vmware_rest.vcenter_vmtemplate_libraryitems_payload_y3uh7acv/ansible_vmware.vmware_rest.vcenter_vmtemplate_libraryitems_payload.zip/ansible_collections/vmware/vmware_rest/plugins/module_utils/vmware_rest.py", line 364, in exists
File "/tmp/ansible_vmware.vmware_rest.vcenter_vmtemplate_libraryitems_payload_y3uh7acv/ansible_vmware.vmware_rest.vcenter_vmtemplate_libraryitems_payload.zip/ansible_collections/vmware/vmware_rest/plugins/module_utils/vmware_rest.py", line 292, in build_full_device_
list
KeyError: 'value'
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f1a95366400>
Unclosed connector
connections: ['deque([(<aiohttp.client_proto.ResponseHandler object at 0x7f1a93f459a0>, 33884708.65422101)])']
connector: <aiohttp.connector.TCPConnector object at 0x7f1a95366310>
module_stdout: ''
msg: |-
MODULE FAILURE
See stdout/stderr for the exact error
rc: 1Code of Conduct
- I agree to follow the Ansible Code of Conduct