fortinet-ansible-dev / ansible-galaxy-fortimanager-collection

GNU General Public License v3.0
16 stars 15 forks source link

fmgr_pkg_firewall_policy_sectionvalue does not work #23

Closed sptschockaert closed 3 years ago

sptschockaert commented 3 years ago

Problem Description: (there was no code of conduct for posting issues, so I apologize if any information is missing or if this is not the appropriate place to post issues - please correct me if/when needed)

I'm hitting AssertionError: wrong last_token received (napi.py:126) when using fmgr_pkg_firewall_policy_sectionvalue. URL defined as follows in fmgr_pkg_firewall_policy_sectionvalue.py:148 perobject_jrpc_urls = [ '/pm/config/adom/{adom}/pkg/{pkg}/firewall/policy/{policy}/{{policy}}/section value' ]

URL as observed via browser: /pm/config/adom/root/pkg/FGT100F-SP/firewall/policy/477/section value

Secondary issue: how does one pass in the policy ID using this mechanism in an ansible playbook? I cannot seem to find any working examples.

System Details: FortiManager version: v6.4.5-build2288 210221 (GA) Python version: 3.9.2 Ansible version: 2.10.7

Stack trace: Traceback (most recent call last): File "/home/thomasschockaert/.ansible/tmp/ansible-local-18508pbkpetlf/ansible-tmp-1618231963.5607805-18546-232691034977584/AnsiballZ_fmgr_pkg_firewall_policy_sectionvalue.py", line 102, in <module> _ansiballz_main() File "/home/thomasschockaert/.ansible/tmp/ansible-local-18508pbkpetlf/ansible-tmp-1618231963.5607805-18546-232691034977584/AnsiballZ_fmgr_pkg_firewall_policy_sectionvalue.py", line 94, in _ansiballz_main invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS) File "/home/thomasschockaert/.ansible/tmp/ansible-local-18508pbkpetlf/ansible-tmp-1618231963.5607805-18546-232691034977584/AnsiballZ_fmgr_pkg_firewall_policy_sectionvalue.py", line 40, in invoke_module runpy.run_module(mod_name='ansible_collections.fortinet.fortimanager.plugins.modules.fmgr_pkg_firewall_policy_sectionvalue', init_globals=None, run_name='__main__', alter_sys=True) 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_fmgr_pkg_firewall_policy_sectionvalue_payload_qzp5plfh/ansible_fmgr_pkg_firewall_policy_sectionvalue_payload.zip/ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_pkg_firewall_policy_sectionvalue.py", line 222, in <module> File "/tmp/ansible_fmgr_pkg_firewall_policy_sectionvalue_payload_qzp5plfh/ansible_fmgr_pkg_firewall_policy_sectionvalue_payload.zip/ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_pkg_firewall_policy_sectionvalue.py", line 215, in main File "/tmp/ansible_fmgr_pkg_firewall_policy_sectionvalue_payload_qzp5plfh/ansible_fmgr_pkg_firewall_policy_sectionvalue_payload.zip/ansible_collections/fortinet/fortimanager/plugins/module_utils/napi.py", line 366, in process_curd File "/tmp/ansible_fmgr_pkg_firewall_policy_sectionvalue_payload_qzp5plfh/ansible_fmgr_pkg_firewall_policy_sectionvalue_payload.zip/ansible_collections/fortinet/fortimanager/plugins/module_utils/napi.py", line 156, in _process_with_mkey File "/tmp/ansible_fmgr_pkg_firewall_policy_sectionvalue_payload_qzp5plfh/ansible_fmgr_pkg_firewall_policy_sectionvalue_payload.zip/ansible_collections/fortinet/fortimanager/plugins/module_utils/napi.py", line 130, in get_object File "/tmp/ansible_fmgr_pkg_firewall_policy_sectionvalue_payload_qzp5plfh/ansible_fmgr_pkg_firewall_policy_sectionvalue_payload.zip/ansible_collections/fortinet/fortimanager/plugins/module_utils/napi.py", line 126, in _get_base_perobject_url AssertionError: wrong last_token received

Playbook: `- hosts: all_fmgs gather_facts: no connection: httpapi collections:

chillancezen commented 3 years ago

hi @sptschockaert, it will be fixed in Galaxy collection 2.0.3

there are three parameters needed, please see https://ansible-galaxy-fortimanager-docs.readthedocs.io/en/galaxy-2.0.3/docgen/fmgr_pkg_firewall_policy_sectionvalue.html

chillancezen commented 3 years ago

2.0.3 has been released. install it by :ansible-galaxy collection install -fn fortinet.fortimanager