Skip to content

[Bug]: netbox.netbox.netbox_devices errors on required field 'role' when adding a device #1083

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rglov opened this issue Oct 7, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@rglov
Copy link

rglov commented Oct 7, 2023

Ansible NetBox Collection version

3.14

Ansible version

ansible [core 2.15.4]
  config file = None
  configured module search path = ['/Users/rglov/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/homebrew/Cellar/ansible/8.4.0/libexec/lib/python3.11/site-packages/ansible
  ansible collection location = /Users/rglov/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/homebrew/bin/ansible
  python version = 3.11.5 (main, Aug 24 2023, 15:09:45) [Clang 14.0.3 (clang-1403.0.22.14.1)] (/opt/homebrew/Cellar/ansible/8.4.0/libexec/bin/python)
  jinja version = 3.1.2
  libyaml = True```


### NetBox version

3.6.3

### Python version

3.11

### Steps to Reproduce

run any example from the documentation.  Even though device_role is defined, the error persists.

### Expected Behavior

device_role would meet requirement

### Observed Behavior

The full traceback is:
  File "/var/folders/wz/3s3y91m93_505kykzwyq1tf80000gn/T/ansible_netbox.netbox.netbox_device_payload_pi6yp6f7/ansible_netbox.netbox.netbox_device_payload.zip/ansible_collections/netbox/netbox/plugins/module_utils/netbox_utils.py", line 1289, in _create_netbox_object
    nb_obj = nb_endpoint.create(data)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/pynetbox/core/endpoint.py", line 415, in create
    ).post(args[0] if args else kwargs)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/pynetbox/core/query.py", line 368, in post
    return self._make_call(verb="post", data=data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/pynetbox/core/query.py", line 258, in _make_call
    raise RequestError(req)
fatal: [localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "cert": null,
            "data": {
                "airflow": null,
                "asset_tag": null,
                "cluster": null,
                "comments": null,
                "custom_fields": null,
                "description": null,
                "device_role": "test-server",
                "device_type": "dell-r640",
                "face": null,
                "local_context_data": null,
                "location": null,
                "name": "Server A",
                "platform": null,
                "position": null,
                "primary_ip4": null,
                "primary_ip6": null,
                "rack": null,
                "serial": "11234",
                "site": "DC1",
                "status": null,
                "tags": null,
                "tenant": null,
                "vc_position": null,
                "vc_priority": null,
                "virtual_chassis": null
            },
            "netbox_token": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "netbox_url": "http://localhost:8000",
            "query_params": null,
            "state": "present",
            "validate_certs": true
        }
    },
    "msg": "{\"role\":[\"This field is required.\"]}"
}
@rglov rglov added the bug Something isn't working label Oct 7, 2023
@rodvand
Copy link
Contributor

rodvand commented Oct 7, 2023

Duplicate of #1061

@rodvand rodvand marked this as a duplicate of #1061 Oct 7, 2023
@rodvand rodvand closed this as completed Oct 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants