Describe the bug
When updating the 'size_gb' value of a VM disk using the int filter, the Playbook fail.
However, if we update the value of another attribute like 'memory_gb' (also of integer type), it works !
PLAY [Update VM] ***************************************************************************************************************************************************************************************************************************
TASK [debug] *******************************************************************************************************************************************************************************************************************************
ok: [localhost] =>
msg: default_disk_size_gb=100 type_debug=int
TASK [Set my_disk_size_gb] *****************************************************************************************************************************************************************************************************************
ok: [localhost]
TASK [debug] *******************************************************************************************************************************************************************************************************************************
ok: [localhost] =>
msg: my_disk_size_gb=200 type_debug=str
TASK [debug] *******************************************************************************************************************************************************************************************************************************
ok: [localhost] =>
msg: my_disk_size_gb=200 type_debug + int_filter=int
TASK [Update VM disk size] *****************************************************************************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: '>=' not supported between instances of 'str' and 'int'
fatal: [localhost]: FAILED! => changed=false
module_stderr: |-
Traceback (most recent call last):
File "/home/my-user/.ansible/tmp/ansible-tmp-1695631123.1564648-281844-166705858546536/AnsiballZ_ntnx_vms.py", line 107, in <module>
_ansiballz_main()
File "/home/my-user/.ansible/tmp/ansible-tmp-1695631123.1564648-281844-166705858546536/AnsiballZ_ntnx_vms.py", line 99, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/home/my-user/.ansible/tmp/ansible-tmp-1695631123.1564648-281844-166705858546536/AnsiballZ_ntnx_vms.py", line 47, in invoke_module
runpy.run_module(mod_name='ansible_collections.nutanix.ncp.plugins.modules.ntnx_vms', init_globals=dict(_module_fqn='ansible_collections.nutanix.ncp.plugins.modules.ntnx_vms', _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_nutanix.ncp.ntnx_vms_payload___pe35ll/ansible_nutanix.ncp.ntnx_vms_payload.zip/ansible_collections/nutanix/ncp/plugins/modules/ntnx_vms.py", line 1003, in <module>
File "/tmp/ansible_nutanix.ncp.ntnx_vms_payload___pe35ll/ansible_nutanix.ncp.ntnx_vms_payload.zip/ansible_collections/nutanix/ncp/plugins/modules/ntnx_vms.py", line 999, in main
File "/tmp/ansible_nutanix.ncp.ntnx_vms_payload___pe35ll/ansible_nutanix.ncp.ntnx_vms_payload.zip/ansible_collections/nutanix/ncp/plugins/modules/ntnx_vms.py", line 991, in run_module
File "/tmp/ansible_nutanix.ncp.ntnx_vms_payload___pe35ll/ansible_nutanix.ncp.ntnx_vms_payload.zip/ansible_collections/nutanix/ncp/plugins/modules/ntnx_vms.py", line 862, in update_vm
File "/tmp/ansible_nutanix.ncp.ntnx_vms_payload___pe35ll/ansible_nutanix.ncp.ntnx_vms_payload.zip/ansible_collections/nutanix/ncp/plugins/module_utils/entity.py", line 226, in get_spec
File "/tmp/ansible_nutanix.ncp.ntnx_vms_payload___pe35ll/ansible_nutanix.ncp.ntnx_vms_payload.zip/ansible_collections/nutanix/ncp/plugins/module_utils/prism/vms.py", line 335, in _build_spec_disks
File "/tmp/ansible_nutanix.ncp.ntnx_vms_payload___pe35ll/ansible_nutanix.ncp.ntnx_vms_payload.zip/ansible_collections/nutanix/ncp/plugins/module_utils/prism/vms.py", line 496, in _update_disk
File "/tmp/ansible_nutanix.ncp.ntnx_vms_payload___pe35ll/ansible_nutanix.ncp.ntnx_vms_payload.zip/ansible_collections/nutanix/ncp/plugins/module_utils/prism/vms.py", line 431, in _generate_disk_spec
TypeError: '>=' not supported between instances of 'str' and 'int'
module_stdout: ''
msg: |-
MODULE FAILURE
See stdout/stderr for the exact error
rc: 1
PLAY RECAP *********************************************************************************************************************************************************************************************************************************
localhost : ok=4 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
Expected behavior
Success playbook when updating the 'size_gb' value of a VM disk using the int filter.
Additional context
Nutanix Version pc.2022.6.0.5
NCC Version: 4.6.3.1
LCM Version: 2.6.2
Debian 12
pipx installation
ansible community version 8.4.0
ansible-core 2.15.4
collection nutanix.ncp version 1.8.0 (tested with version 1.9.0 too)
ansible-doc nutanix.ncp.ntnx_vms
...
- disks
...
- size_gb
The Disk Size in GB.
This option is applicable for only DISK type above.
default: null
type: int
...
- memory_gb
Memory size in GB
default: null
type: int
Describe the bug When updating the 'size_gb' value of a VM disk using the int filter, the Playbook fail. However, if we update the value of another attribute like 'memory_gb' (also of integer type), it works !
To Reproduce Steps to reproduce the behavior:
ansible-playbook vm-update-disk.yml
Playbook vm-update-disk.yml:
Stack trace
Expected behavior Success playbook when updating the 'size_gb' value of a VM disk using the int filter.
Additional context
Nutanix Version pc.2022.6.0.5 NCC Version: 4.6.3.1 LCM Version: 2.6.2
Debian 12 pipx installation ansible community version 8.4.0 ansible-core 2.15.4
collection nutanix.ncp version 1.8.0 (tested with version 1.9.0 too)
ansible-doc nutanix.ncp.ntnx_vms
Thanks