ansible-collections / community.routeros

Ansible modules for managing MikroTik RouterOS instances.
https://galaxy.ansible.com/ui/repo/published/community/routeros/
GNU General Public License v3.0
99 stars 45 forks source link

community.routeros.facts not working for MikroTik RouterOS 7.9 #181

Closed izzzhoga closed 1 year ago

izzzhoga commented 1 year ago
SUMMARY

Hello, when trying to collect facts from the device, the playbook ends with an error. For me now the problem is observed for the version of MikroTik RouterOS 7.9 I contacted you with this error (https://github.com/ansible-collections/community.routeros/issues/170), but the problem still remained... I updated the module to the latest version and tried to run the role on the same device.

ISSUE TYPE
COMPONENT NAME

community.routeros.facts

ANSIBLE VERSION
ansible [core 2.13.6]
config file = /home/user/mkt/ansible.cfg
configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.9/dist-packages/ansible
ansible collection location = /home/user/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]
jinja version = 3.1.2
libyaml = True
COLLECTION VERSION
# /usr/local/lib/python3.9/dist-packages/ansible_collections
Collection         Version
------------------ -------
community.routeros 2.4.0  

# /home/user/.ansible/collections/ansible_collections
Collection         Version
------------------ -------
community.routeros 2.8.0
CONFIGURATION
DEFAULT_FORKS(/home/user/mkt/ansible.cfg) = 50
DEFAULT_HOST_LIST(/home/user/mkt/ansible.cfg) = ['/home/user/mkt/dynamic-inventory.yml']
DEFAULT_TIMEOUT(/home/user/mkt/ansible.cfg) = 10
DEFAULT_VAULT_PASSWORD_FILE(/home/user/mkt/ansible.cfg) = /home/user/mkt/.ansible_vault_pass
DEPRECATION_WARNINGS(/home/user/mkt/ansible.cfg) = False
HOST_KEY_CHECKING(/home/user/mkt/ansible.cfg) = False
PERSISTENT_COMMAND_TIMEOUT(/home/user/mkt/ansible.cfg) = 60
PERSISTENT_CONNECT_TIMEOUT(/home/user/mkt/ansible.cfg) = 60
RETRY_FILES_ENABLED(/home/user/mkt/ansible.cfg) = True
RETRY_FILES_SAVE_PATH(/home/user/mkt/ansible.cfg) = /home/user/mkt/retry-files
OS / ENVIRONMENT

MikroTik RouterOS 7.9

STEPS TO REPRODUCE
- name: Collect all facts from the device
  community.routeros.facts:
    gather_subset: all
  register: all_facts
EXPECTED RESULTS
TASK [function/mkt/func-mkt-get-prerequisites : Collect all facts from the device] *******************************
ok: [mikrotik]
ACTUAL RESULTS
The full traceback is:
Traceback (most recent call last):
  File "/home/user/.ansible/tmp/ansible-local-311330976uvos6p/ansible-tmp-1686716586.6644022-3114012-13424969385580/AnsiballZ_facts.py", line 107, in <module>
    _ansiballz_main()
  File "/home/user/.ansible/tmp/ansible-local-311330976uvos6p/ansible-tmp-1686716586.6644022-3114012-13424969385580/AnsiballZ_facts.py", line 99, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/user/.ansible/tmp/ansible-local-311330976uvos6p/ansible-tmp-1686716586.6644022-3114012-13424969385580/AnsiballZ_facts.py", line 47, in invoke_module
    runpy.run_module(mod_name='ansible_collections.community.routeros.plugins.modules.facts', init_globals=dict(_module_fqn='ansible_collections.community.routeros.plugins.modules.facts', _modlib_path=modlib_path),
  File "/usr/lib/python3.9/runpy.py", line 210, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib/python3.9/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_community.routeros.facts_payload_8zc2v29p/ansible_community.routeros.facts_payload.zip/ansible_collections/community/routeros/plugins/modules/facts.py", line 663, in <module>
  File "/tmp/ansible_community.routeros.facts_payload_8zc2v29p/ansible_community.routeros.facts_payload.zip/ansible_collections/community/routeros/plugins/modules/facts.py", line 651, in main
  File "/tmp/ansible_community.routeros.facts_payload_8zc2v29p/ansible_community.routeros.facts_payload.zip/ansible_collections/community/routeros/plugins/modules/facts.py", line 455, in populate
  File "/tmp/ansible_community.routeros.facts_payload_8zc2v29p/ansible_community.routeros.facts_payload.zip/ansible_collections/community/routeros/plugins/modules/facts.py", line 532, in parse_route
  File "/tmp/ansible_community.routeros.facts_payload_8zc2v29p/ansible_community.routeros.facts_payload.zip/ansible_collections/community/routeros/plugins/modules/facts.py", line 474, in preprocess
IndexError: list index out of range
fatal: [mikrotik]: FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"/home/user/.ansible/tmp/ansible-local-311330976uvos6p/ansible-tmp-1686716586.6644022-3114012-13424969385580/AnsiballZ_facts.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/home/user/.ansible/tmp/ansible-local-311330976uvos6p/ansible-tmp-1686716586.6644022-3114012-13424969385580/AnsiballZ_facts.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/user/.ansible/tmp/ansible-local-311330976uvos6p/ansible-tmp-1686716586.6644022-3114012-13424969385580/AnsiballZ_facts.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.community.routeros.plugins.modules.facts', init_globals=dict(_module_fqn='ansible_collections.community.routeros.plugins.modules.facts', _modlib_path=modlib_path),\n  File \"/usr/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/lib/python3.9/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib/python3.9/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_community.routeros.facts_payload_8zc2v29p/ansible_community.routeros.facts_payload.zip/ansible_collections/community/routeros/plugins/modules/facts.py\", line 663, in <module>\n  File \"/tmp/ansible_community.routeros.facts_payload_8zc2v29p/ansible_community.routeros.facts_payload.zip/ansible_collections/community/routeros/plugins/modules/facts.py\", line 651, in main\n  File \"/tmp/ansible_community.routeros.facts_payload_8zc2v29p/ansible_community.routeros.facts_payload.zip/ansible_collections/community/routeros/plugins/modules/facts.py\", line 455, in populate\n  File \"/tmp/ansible_community.routeros.facts_payload_8zc2v29p/ansible_community.routeros.facts_payload.zip/ansible_collections/community/routeros/plugins/modules/facts.py\", line 532, in parse_route\n  File \"/tmp/ansible_community.routeros.facts_payload_8zc2v29p/ansible_community.routeros.facts_payload.zip/ansible_collections/community/routeros/plugins/modules/facts.py\", line 474, in preprocess\nIndexError: list index out of range\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}
felixfontein commented 1 year ago

There hasn't been a new release since that was fixed. Does the problem also happen with the main branch? If no, then the problem will be gone with the next release.

felixfontein commented 1 year ago

Please try again, I just triggered a release.

izzzhoga commented 1 year ago

Thank you very much! With version 2.8.1 everything works correctly