Skip to content

[Bug]: assigned_object_type not usable as query_parameter in netbox.netbox.netbox_mac_address module. #1477

@tortuegenialez

Description

@tortuegenialez

Ansible NetBox Collection version

3.21.0

Ansible version

ansible [core 2.18.3]
  config file = /home/user/work/sources/ansible/ansible.cfg
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/user/work/sources/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.11.2 (main, Apr 28 2025, 14:11:48) [GCC 12.2.0] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True

NetBox version

NetBox Community v4.4.1-Docker-3.4.0

Python version

3.11

Steps to Reproduce

Use a task with the mac address module:

    - name: Create MAC address with assignation to the host and interface
      netbox.netbox.netbox_mac_address:
        netbox_url: "{{ netbox_url }}"
        netbox_token: "{{ netbox_token }}"
        data:
          mac_address: "00:11:22:33:44:55"
          assigned_object:
            device: "host01"
            name: "eth0"
        query_params:
          - assigned_object_type

Expected Behavior

Netbox would set or return the mac address

Observed Behavior

An error message is returned: "{\"assigned_object_type\":[\"Select a valid choice. That choice is not one of the available choices.\"

This choice seems to be valid.
When setting a wrong choice in the query_params (test_choice in this exemple) the module returns a list of valid choices:
One or more of the kwargs provided are invalid for mac_address, provided kwargs: assigned_object, assigned_object_id, assigned_object_type, mac_address. Acceptable kwargs: test_choice.

Note that acceptable kwargs and provided kwargs are inverted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions