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
I get a Python KeyError exception. Please catch this error and provide a useful error message.
TASK [Add second disk (REST)] ******************************************************************************************************************************************************************************************
fatal: [grohmann-src-168]: FAILED! => changed=false
msg:
- |2-
File "/usr/lib64/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
- |2-
File "/usr/lib64/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
- |2-
File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_hardware_disk_payload_qx_9n8yt/ansible_vmware.vmware_rest.vcenter_vm_hardware_disk_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/server.py", line 395, in <module>
- |2-
File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_hardware_disk_payload_qx_9n8yt/ansible_vmware.vmware_rest.vcenter_vm_hardware_disk_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/server.py", line 372, in start
- |2-
File "/usr/lib64/python3.10/asyncio/base_events.py", line 603, in run_forever
self._run_once()
- |2-
File "/usr/lib64/python3.10/asyncio/base_events.py", line 1899, in _run_once
handle._run()
- |2-
File "/usr/lib64/python3.10/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
- |2-
File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_hardware_disk_payload_qx_9n8yt/ansible_vmware.vmware_rest.vcenter_vm_hardware_disk_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/server.py", line 342, in handle
- |2-
File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_hardware_disk_payload_qx_9n8yt/ansible_vmware.vmware_rest.vcenter_vm_hardware_disk_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/server.py", line 297, in run_as_module
- |-
Traceback (most recent call last):
File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_hardware_disk_payload_qx_9n8yt/ansible_vmware.vmware_rest.vcenter_vm_hardware_disk_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/server.py", line 201, in run
File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_hardware_disk_payload_qx_9n8yt/ansible_vmware.vmware_rest.vcenter_vm_hardware_disk_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vm_hardware_disk.py", line 333, in main
result = await entry_point(module, session)
File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_hardware_disk_payload_qx_9n8yt/ansible_vmware.vmware_rest.vcenter_vm_hardware_disk_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vm_hardware_disk.py", line 358, in entry_point
return await func(module.params, session)
File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_hardware_disk_payload_qx_9n8yt/ansible_vmware.vmware_rest.vcenter_vm_hardware_disk_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vm_hardware_disk.py", line 386, in _create
_json = await exists(
File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_hardware_disk_payload_qx_9n8yt/ansible_vmware.vmware_rest.vcenter_vm_hardware_disk_payload.zip/ansible_collections/vmware/vmware_rest/plugins/module_utils/vmware_rest.py", line 369, in exists
full_devices = await build_full_device_list(session, per_id_url, devices)
File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_hardware_disk_payload_qx_9n8yt/ansible_vmware.vmware_rest.vcenter_vm_hardware_disk_payload.zip/ansible_collections/vmware/vmware_rest/plugins/module_utils/vmware_rest.py", line 294, in build_full_device_list
value = device_list["value"]
KeyError: 'value'
I extended to code locally to print the content of the device_list structure.
284 async def build_full_device_list(session, url, device_list):
285 import asyncio
286
287 device_ids = []
288
289 if isinstance(device_list, list):
290 value = device_list
291 else: # 7.0.2 <
292 s=open('/tmp/error.txt', mode='w')
293 import pprint; pprint.pprint(device_list, stream=s)
294 value = device_list["value"]
295 for i in value:
296 # Content library returns string {"value": "library_id"}
297 if isinstance(i, str):
298 device_ids.append(i)
299 continue
300 fields = list(i.values())
301 if len(fields) != 1:
302 # The list already comes with all the details
303 return device_list
304 device_ids.append(fields[0])
305
306 tasks = [
307 asyncio.ensure_future(get_device_info(session, url, _id)) for _id in device_ids
308 ]
309
310 return [await i for i in tasks]
# cat /tmp/error.txt
{'error_type': 'NOT_FOUND',
'messages': [{'args': [],
'default_message': 'The object '
"'vim.ManagedEntity:myvm1' has "
'already been deleted or has not been '
'completely created',
'id': 'vmsg.ManagedObjectNotFound.summary'}]}
SUMMARY
I get a Python KeyError exception. Please catch this error and provide a useful error message.
I extended to code locally to print the content of the
device_list
structure.ISSUE TYPE
COMPONENT NAME
vmware_rest.vcenter_vm_hardware_disk
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
OS
vSphere:
vSphere Client version 7.0.3.01100
Hypervisor:
VMware ESXi, 6.7.0, 17700523
STEPS TO REPRODUCE
The text was updated successfully, but these errors were encountered: