fortinet-ansible-dev / ansible-galaxy-fortios-collection

GNU General Public License v3.0
85 stars 49 forks source link

Cannot delete/mark as absent static route #315

Closed phonics52 closed 2 months ago

phonics52 commented 4 months ago

Hi, I have created a simple play book to add a static route, which works great. However, when I then mark it as absent I get module errors. Any advice would be appreciated.

The full traceback is: Traceback (most recent call last): File "/home/phonics52/.ansible/tmp/ansible-local-3050306dxtv4mat/ansible-tmp-1717426687.9648921-3050309-25242095761979/AnsiballZ_fortios_router_static.py", line 107, in _ansiballz_main() File "/home/phonics52/.ansible/tmp/ansible-local-3050306dxtv4mat/ansible-tmp-1717426687.9648921-3050309-25242095761979/AnsiballZ_fortios_router_static.py", line 99, in _ansiballz_main invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS) File "/home/phonics52/.ansible/tmp/ansible-local-3050306dxtv4mat/ansible-tmp-1717426687.9648921-3050309-25242095761979/AnsiballZ_fortios_router_static.py", line 47, in invoke_module runpy.run_module(mod_name='ansible_collections.fortinet.fortios.plugins.modules.fortios_router_static', init_globals=dict(_module_fqn='ansible_collections.fortinet.fortios.plugins.modules.fortios_router_static', _modlib_path=modlib_path), File "/usr/lib/python3.10/runpy.py", line 224, in run_module return _run_module_code(code, init_globals, run_name, mod_spec) File "/usr/lib/python3.10/runpy.py", line 96, in _run_module_code _run_code(code, mod_globals, init_globals, File "/usr/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/tmp/ansible_fortinet.fortios.fortios_router_static_payload_65lxtqsn/ansible_fortinet.fortios.fortios_router_static_payload.zip/ansible_collections/fortinet/fortios/plugins/modules/fortios_router_static.py", line 652, in File "/tmp/ansible_fortinet.fortios.fortios_router_static_payload_65lxtqsn/ansible_fortinet.fortios.fortios_router_static_payload.zip/ansible_collections/fortinet/fortios/plugins/modules/fortios_router_static.py", line 618, in main File "/tmp/ansible_fortinet.fortios.fortios_router_static_payload_65lxtqsn/ansible_fortinet.fortios.fortios_router_static_payload.zip/ansible_collections/fortinet/fortios/plugins/modules/fortios_router_static.py", line 482, in fortios_router File "/tmp/ansible_fortinet.fortios.fortios_router_static_payload_65lxtqsn/ansible_fortinet.fortios.fortios_router_static_payload.zip/ansible_collections/fortinet/fortios/plugins/modules/fortios_router_static.py", line 462, in router_static KeyError: 'seq-num' fatal: [Home_FW]: FAILED! => { "changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/home/phonics52/.ansible/tmp/ansible-local-3050306dxtv4mat/ansible-tmp-1717426687.9648921-3050309-25242095761979/AnsiballZ_fortios_router_static.py\", line 107, in \n _ansiballz_main()\n File \"/home/phonics52/.ansible/tmp/ansible-local-3050306dxtv4mat/ansible-tmp-1717426687.9648921-3050309-25242095761979/AnsiballZ_fortios_router_static.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/phonics52/.ansible/tmp/ansible-local-3050306dxtv4mat/ansible-tmp-1717426687.9648921-3050309-25242095761979/AnsiballZ_fortios_router_static.py\", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.fortinet.fortios.plugins.modules.fortios_router_static', init_globals=dict(_module_fqn='ansible_collections.fortinet.fortios.plugins.modules.fortios_router_static', _modlib_path=modlib_path),\n File \"/usr/lib/python3.10/runpy.py\", line 224, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib/python3.10/runpy.py\", line 96, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/usr/lib/python3.10/runpy.py\", line 86, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_fortinet.fortios.fortios_router_static_payload_65lxtqsn/ansible_fortinet.fortios.fortios_router_static_payload.zip/ansible_collections/fortinet/fortios/plugins/modules/fortios_router_static.py\", line 652, in \n File \"/tmp/ansible_fortinet.fortios.fortios_router_static_payload_65lxtqsn/ansible_fortinet.fortios.fortios_router_static_payload.zip/ansible_collections/fortinet/fortios/plugins/modules/fortios_router_static.py\", line 618, in main\n File \"/tmp/ansible_fortinet.fortios.fortios_router_static_payload_65lxtqsn/ansible_fortinet.fortios.fortios_router_static_payload.zip/ansible_collections/fortinet/fortios/plugins/modules/fortios_router_static.py\", line 482, in fortios_router\n File \"/tmp/ansible_fortinet.fortios.fortios_router_static_payload_65lxtqsn/ansible_fortinet.fortios.fortios_router_static_payload.zip/ansible_collections/fortinet/fortios/plugins/modules/fortios_router_static.py\", line 462, in router_static\nKeyError: 'seq-num'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1 }

JieX19 commented 4 months ago

Hi @phonics52

I can reproduce the error, there's a bug in the latest version and we will fix it in the next release. I tried version 2.3.5 and the router_static object was deleted successfully.

Thanks, Jie

phonics52 commented 4 months ago

Hi @JieX19

Many thanks for the response, do you have a release date for the next version?

Thanks

MaxxLiu22 commented 2 months ago

Hi @phonics52

We just released Ansible FOS 2.3.7. This issue should be fixed, so you could upgrade to it and give it a try at your convenience.

ansible-galaxy collection install fortinet.fortios:2.3.7

Thanks, Maxx

phonics52 commented 2 months ago

Hi @MaxxLiu22

Thank you, this is now working.