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

GNU General Public License v3.0
84 stars 47 forks source link

Error in comparison/serialize #301

Open hvanderheide opened 4 months ago

hvanderheide commented 4 months ago

There is an error in the serialize logic when running a task in diff mode, introduced in 44771120d0868cde6a24f8a280920f9733bbc8a4

The full traceback is: Traceback (most recent call last): File "", line 107, in File "", line 99, in _ansiballz_main File "", line 47, in invoke_module File "", line 226, in run_module File "", line 98, in _run_module_code File "", line 88, in _runcode File "/var/folders/k/5ttlkcg17zv48nxy_288yc_c0000gp/T/ansible_fortinet.fortios.fortios_vpn_ipsec_phase1_interface_payload_svvknff2/ansible_fortinet.fortios.fortios_vpn_ipsec_phase1_interface_payload.zip/ansible_collections/fortinet/fortios/plugins/modules/fortios_vpn_ipsec_phase1interface.py", line 2581, in File "/var/folders/k/5ttlkcg17zv48nxy_288yc_c0000gp/T/ansible_fortinet.fortios.fortios_vpn_ipsec_phase1_interface_payload_svvknff2/ansible_fortinet.fortios.fortios_vpn_ipsec_phase1_interface_payload.zip/ansible_collections/fortinet/fortios/plugins/modules/fortios_vpn_ipsec_phase1interface.py", line 2547, in main File "/var/folders/k/5ttlkcg17zv48nxy_288yc_c0000gp/T/ansible_fortinet.fortios.fortios_vpn_ipsec_phase1_interface_payload_svvknff2/ansible_fortinet.fortios.fortios_vpn_ipsec_phase1_interface_payload.zip/ansible_collections/fortinet/fortios/plugins/modules/fortios_vpn_ipsec_phase1_interface.py", line 1755, in fortios_vpnipsec File "/var/folders/k/5ttlkcg17zv48nxy_288yc_c0000gp/T/ansible_fortinet.fortios.fortios_vpn_ipsec_phase1_interface_payload_svvknff2/ansible_fortinet.fortios.fortios_vpn_ipsec_phase1_interface_payload.zip/ansible_collections/fortinet/fortios/plugins/modules/fortios_vpn_ipsec_phase1_interface.py", line 1692, in vpn_ipsec_phase1interface File "/var/folders/k/5ttlkcg17zv48nxy_288yc_c0000gp/T/ansible_fortinet.fortios.fortios_vpn_ipsec_phase1_interface_payload_svvknff2/ansible_fortinet.fortios.fortios_vpn_ipsec_phase1_interface_payload.zip/ansible_collections/fortinet/fortios/plugins/module_utils/fortios/comparison.py", line 124, in serialize KeyError: 0

Alabate commented 4 months ago

Same issue for a simple

- fortinet.fortios.fortios_system_admin:
    vdom: "{{ fortigate_vdom }}"
    state: present
    system_admin:
      name: "{{ fortigate_admin_username}}"
      accprofile: super_admin

In check mode we get the same error.

We don't have the issue on version 2.3.4, so we rolled back the collection to this version for now.

JieX19 commented 3 months ago

Hi @hvanderheide,

Thank you so much for bringing up the issue and dedicating time to debugging! We have a policy that prohibits merging code from external sources, so I will fix and test it from our side. Thank you again for your time!

Jie

hvanderheide commented 3 months ago

Hi @JieX19, that doesn't seem like a very productive policy, but I guess that's up to you. How do you propose we provide you with patches? I have a number of other small fixes to the check/diff logic, so it would help if this is documented somewhere.

JieX19 commented 3 months ago

Hi @hvanderhei

Thank you very much for your feedback. I apologize for any inconvenience caused. If you have patches or fixes to contribute, you can provide them as you did for the last pull request, and I'll do my best to assist you with reviewing and integrating the changes. If you have multiple fixes, providing them one by one would be helpful for clarity and organization. Additionally, you can specify any particular areas or files where the fixes apply to ensure accurate integration. Let me know how you'd like to proceed, and I'll be glad to assist you further.

Thanks, Jie