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

User Module: TypeError 'user_dn' #111

Closed KiLLuuuhh closed 4 months ago

KiLLuuuhh commented 4 months ago

Describe the bug While trying the version 1.1.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: TypeError: __init__() got an unexpected keyword argument 'user_dn'
fatal: [HOSTNAME]: FAILED! => changed=false 
  module_stderr: |-
    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_lkxxt140/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_lkxxt140/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_lkxxt140/ansible_puzzle.opnsense.system_access_users_payload.zip/ansible_collections/puzzle/opnsense/plugins/module_utils/system_access_users_utils.py", line 576, in __init__
      File "/tmp/ansible_puzzle.opnsense.system_access_users_payload_lkxxt140/ansible_puzzle.opnsense.system_access_users_payload.zip/ansible_collections/puzzle/opnsense/plugins/module_utils/system_access_users_utils.py", line 612, in _load_users
      File "/tmp/ansible_puzzle.opnsense.system_access_users_payload_lkxxt140/ansible_puzzle.opnsense.system_access_users_payload.zip/ansible_collections/puzzle/opnsense/plugins/module_utils/system_access_users_utils.py", line 612, in <listcomp>
      File "/tmp/ansible_puzzle.opnsense.system_access_users_payload_lkxxt140/ansible_puzzle.opnsense.system_access_users_payload.zip/ansible_collections/puzzle/opnsense/plugins/module_utils/system_access_users_utils.py", line 523, in from_xml
    TypeError: __init__() got an unexpected keyword argument 'user_dn'
  module_stdout: ''
  msg: |-
    MODULE FAILURE
    See stdout/stderr for the exact error
  rc: 1

It seems that the argument user_dn isn't handled in the system_access_users module.

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 an OPNsense Instance
  3. see error as described above

Expected behavior The argument user_dn and other unkown arguments are expected and handled by the system_access_users module.