ScaleComputing / HyperCoreAnsibleCollection

Official Ansible collection for Scale Computing SC//HyperCore (HC3) v1 API
GNU General Public License v3.0
12 stars 8 forks source link

vm_replication_info module fails if both snapshot schedule and replication are unconfigured. #24

Closed justinc1 closed 2 years ago

justinc1 commented 2 years ago

To reproduce, create a fresh VM. The snapshot schedule and replication will be both unconfigured. Then invoke vm_replication_info for it - it failed with:

.venv) [justin_cinkelj@jcdell hypercore]$ ansible-playbook -i localhost, -e vm_name=test-tiering examples/vm_replication_info.yml
[WARNING]: running playbook inside collection scale_computing.hypercore

PLAY [Show replication settings for a specific VM] *******************************************************************************************************************************************************************************************

TASK [Get replication info for VM test-tiering] **********************************************************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: IndexError: list index out of range
fatal: [localhost]: FAILED! => changed=false 
  ansible_facts:
    discovered_interpreter_python: /usr/bin/python3
  module_stderr: |-
    Traceback (most recent call last):
      File "/home/justin_cinkelj/.ansible/tmp/ansible-tmp-1664568208.2079709-14900-75182818547833/AnsiballZ_vm_replication_info.py", line 107, in <module>
        _ansiballz_main()
      File "/home/justin_cinkelj/.ansible/tmp/ansible-tmp-1664568208.2079709-14900-75182818547833/AnsiballZ_vm_replication_info.py", line 99, in _ansiballz_main
        invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
      File "/home/justin_cinkelj/.ansible/tmp/ansible-tmp-1664568208.2079709-14900-75182818547833/AnsiballZ_vm_replication_info.py", line 47, in invoke_module
        runpy.run_module(mod_name='ansible_collections.scale_computing.hypercore.plugins.modules.vm_replication_info', init_globals=dict(_module_fqn='ansible_collections.scale_computing.hypercore.plugins.modules.vm_replication_info', _modlib_path=modlib_path),
      File "/usr/lib64/python3.10/runpy.py", line 209, in run_module
        return _run_module_code(code, init_globals, run_name, mod_spec)
      File "/usr/lib64/python3.10/runpy.py", line 96, in _run_module_code
        _run_code(code, mod_globals, init_globals,
      File "/usr/lib64/python3.10/runpy.py", line 86, in _run_code
        exec(code, run_globals)
      File "/tmp/ansible_scale_computing.hypercore.vm_replication_info_payload_mzqi50e6/ansible_scale_computing.hypercore.vm_replication_info_payload.zip/ansible_collections/scale_computing/hypercore/plugins/modules/vm_replication_info.py", line 110, in <module>
      File "/tmp/ansible_scale_computing.hypercore.vm_replication_info_payload_mzqi50e6/ansible_scale_computing.hypercore.vm_replication_info_payload.zip/ansible_collections/scale_computing/hypercore/plugins/modules/vm_replication_info.py", line 103, in main
      File "/tmp/ansible_scale_computing.hypercore.vm_replication_info_payload_mzqi50e6/ansible_scale_computing.hypercore.vm_replication_info_payload.zip/ansible_collections/scale_computing/hypercore/plugins/modules/vm_replication_info.py", line 76, in run
    IndexError: list index out of range
  module_stdout: ''
  msg: |-
    MODULE FAILURE
    See stdout/stderr for the exact error
  rc: 1

VM with both snapshot schedule and replication set was not a problem.

justinc1 commented 2 years ago

A CI test for this added to a branch. We need to decide what should module output for such VM.