puzzle / puzzle.opnsense

An Ansible Collection to configure an opnsense Firewall
https://puzzle.github.io/puzzle.opnsense/collections/puzzle/opnsense/index.html
GNU General Public License v3.0
23 stars 12 forks source link

KeyError: '24.1.4': Minor versions not supported #108

Closed KiLLuuuhh closed 4 months ago

KiLLuuuhh commented 4 months ago

Describe the bug While trying the version 1.0.0 of the Ansible Collection, we ran into the following issue:

TASK [opnsense_manage : Get api key] *************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: Supported versions are ['22.7', '23.1', '23.7', '24.1']
fatal: [fw02.cloud-staging.puzzle.ch]: FAILED! => changed=false 
  module_stderr: |-
    Traceback (most recent call last):
      File "/tmp/ansible_puzzle.opnsense.system_access_users_payload_r0be_plh/ansible_puzzle.opnsense.system_access_users_payload.zip/ansible_collections/puzzle/opnsense/plugins/module_utils/config_utils.py", line 115, in __init__
    KeyError: '24.1.4'

    The above exception was the direct cause of the following exception:

    Traceback (most recent call last):
      File "<stdin>", line 107, in <module>
      File "<stdin>", line 99, in _ansiballz_main
      File "<stdin>", line 47, in invoke_module
      File "/usr/local/lib/python3.9/runpy.py", line 225, in run_module
        return _run_module_code(code, init_globals, run_name, mod_spec)
      File "/usr/local/lib/python3.9/runpy.py", line 97, in _run_module_code
        _run_code(code, mod_globals, init_globals,
      File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
        exec(code, run_globals)
      File "/tmp/ansible_puzzle.opnsense.system_access_users_payload_r0be_plh/ansible_puzzle.opnsense.system_access_users_payload.zip/ansible_collections/puzzle/opnsense/plugins/modules/system_access_users.py", line 268, in <module>
      File "/tmp/ansible_puzzle.opnsense.system_access_users_payload_r0be_plh/ansible_puzzle.opnsense.system_access_users_payload.zip/ansible_collections/puzzle/opnsense/plugins/modules/system_access_users.py", line 227, in main
      File "/tmp/ansible_puzzle.opnsense.system_access_users_payload_r0be_plh/ansible_puzzle.opnsense.system_access_users_payload.zip/ansible_collections/puzzle/opnsense/plugins/module_utils/system_access_users_utils.py", line 571, in __init__
      File "/tmp/ansible_puzzle.opnsense.system_access_users_payload_r0be_plh/ansible_puzzle.opnsense.system_access_users_payload.zip/ansible_collections/puzzle/opnsense/plugins/module_utils/config_utils.py", line 117, in __init__
    ansible_collections.puzzle.opnsense.plugins.module_utils.config_utils.UnsupportedOPNsenseVersion: OPNsense version '24.1.4' not supported by puzzle.opnsense collection.
    Supported versions are ['22.7', '23.1', '23.7', '24.1']
  module_stdout: ''
  msg: |-
    MODULE FAILURE
    See stdout/stderr for the exact error
  rc: 1

It seems that the return attribute product_version of the function plugins/module_utils/version_utils.plugins.get_opnsense_version does not match the versions stated in the VERSION_MAP.

To Reproduce Steps to reproduce the behavior:

  1. Create Playbook entry like:
    - name: Get api key
    puzzle.opnsense.system_access_users:
    username: example_user
    password: "{{ ansible_password }}"
    apikeys: ""
    register: root_api_keys
  2. run play against OPNsense Instance with Version: 24.1.4
  3. see error as described above

Expected behavior The returned product_version of the function plugins/module_utils/version_utils.plugins.get_opnsense_version should match the VERSION_MAP.