ideadevice / ansible-ahv-provider-plugin

Ansible plugins to interact with AHV APIs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem with data option to filter payload in info module

tuxtof opened this issue · comments

there is no default value for data attributes so if you don't specify all of them playbook failed

example

- name: VM Inventory example
  hosts: localhost
  vars_files:
  - spe-pc.yaml
  collections:
  - nutanix.nutanix
  tasks:
    - name: List vms
      nutanix_vm_info:
        pc_hostname: "{{ pc_hostname }}"
        pc_username: "{{ pc_username }}"
        pc_password: "{{ pc_password }}"
        validate_certs: False
        data:
          filter: "vm_name=={{ vm_name }}"
      register: result
    - debug:
        msg: "{{ result.vms }}"

failed with

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: '<' not supported between instances of 'NoneType' and 'int'
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/Users/cris/.ansible/tmp/ansible-tmp-1626864386.760855-3051-42770005357494/AnsiballZ_nutanix_vm_info.py\", line 100, in <module>\n    _ansiballz_main()\n  File \"/Users/cris/.ansible/tmp/ansible-tmp-1626864386.760855-3051-42770005357494/AnsiballZ_nutanix_vm_info.py\", line 92, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/Users/cris/.ansible/tmp/ansible-tmp-1626864386.760855-3051-42770005357494/AnsiballZ_nutanix_vm_info.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.nutanix.nutanix.plugins.modules.nutanix_vm_info', init_globals=dict(_module_fqn='ansible_collections.nutanix.nutanix.plugins.modules.nutanix_vm_info', _modlib_path=modlib_path),\n  File \"/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py\", line 210, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/var/folders/g3/t0x1k_1d3_g9jqwr4nt67fkw0000gn/T/ansible_nutanix_vm_info_payload_56xnxkfb/ansible_nutanix_vm_info_payload.zip/ansible_collections/nutanix/nutanix/plugins/modules/nutanix_vm_info.py\", line 217, in <module>\n  File \"/var/folders/g3/t0x1k_1d3_g9jqwr4nt67fkw0000gn/T/ansible_nutanix_vm_info_payload_56xnxkfb/ansible_nutanix_vm_info_payload.zip/ansible_collections/nutanix/nutanix/plugins/modules/nutanix_vm_info.py\", line 213, in main\n  File \"/var/folders/g3/t0x1k_1d3_g9jqwr4nt67fkw0000gn/T/ansible_nutanix_vm_info_payload_56xnxkfb/ansible_nutanix_vm_info_payload.zip/ansible_collections/nutanix/nutanix/plugins/modules/nutanix_vm_info.py\", line 191, in get_vm_list\nTypeError: '<' not supported between instances of 'NoneType' and 'int'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}