Skip to content
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

serial: This field may not be null. (on disks?) #270

Open
rhaamo opened this issue Apr 7, 2023 · 1 comment
Open

serial: This field may not be null. (on disks?) #270

rhaamo opened this issue Apr 7, 2023 · 1 comment

Comments

@rhaamo
Copy link

rhaamo commented Apr 7, 2023

Describe the bug
Getting that error:

DEBUG:urllib3.connectionpool:https://netbox.xxx:443 "GET /api/dcim/manufacturers/?name=WDC&limit=0 HTTP/1.1" 200 372
DEBUG:urllib3.connectionpool:https://netbox.xxx:443 "POST /api/dcim/inventory-items/ HTTP/1.1" 201 883
INFO:root:Creating Disk WD3000BKHG xx-xxx-xxx
DEBUG:urllib3.connectionpool:https://netbox.xxx:443 "GET /api/dcim/manufacturers/?name=DVD-ROM+DV-28SW&limit=0 HTTP/1.1" 200 408
DEBUG:urllib3.connectionpool:https://netbox.xxx:443 "POST /api/dcim/inventory-items/ HTTP/1.1" 400 42
Traceback (most recent call last):
  File "/usr/local/bin/netbox_agent", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/dist-packages/netbox_agent/cli.py", line 50, in main
    return run(config)
  File "/usr/local/lib/python3.9/dist-packages/netbox_agent/cli.py", line 43, in run
    server.netbox_create_or_update(config)
  File "/usr/local/lib/python3.9/dist-packages/netbox_agent/server.py", line 419, in netbox_create_or_update
    self.inventory.create_or_update()
  File "/usr/local/lib/python3.9/dist-packages/netbox_agent/inventory.py", line 548, in create_or_update
    self.do_netbox_disks()
  File "/usr/local/lib/python3.9/dist-packages/netbox_agent/inventory.py", line 446, in do_netbox_disks
    self.create_netbox_disk(disk)
  File "/usr/local/lib/python3.9/dist-packages/netbox_agent/inventory.py", line 389, in create_netbox_disk
    _ = nb.dcim.inventory_items.create(**parms)
  File "/usr/local/lib/python3.9/dist-packages/pynetbox/core/endpoint.py", line 304, in create
    req = Request(
  File "/usr/local/lib/python3.9/dist-packages/pynetbox/core/query.py", line 387, in post
    return self._make_call(verb="post", data=data)
  File "/usr/local/lib/python3.9/dist-packages/pynetbox/core/query.py", line 282, in _make_call
    raise RequestError(req)
pynetbox.core.query.RequestError: The request failed with code 400 Bad Request: {'serial': ['This field may not be null.']}

Expected behavior
It should works.

Configuration file

netbox:
 url: 'https://xxx/'
 token: 'xxx'
 # uncomment to disable ssl verification
 ssl_verify: 'True'

network:
  ignore_interfaces: '(dummy.*|docker.*)'
  ignore_ips: '(127\.0\.0\..*)'
  # enable auto-cabling
  lldp: 'True'

device:
 server_role: "Server"
 tags: "dell,proxmox,10g,bonding,physical"

datacenter_location:
 driver: "cmd:echo home"
 regex: "(.*)"

inventory: "True"

Environment:

  • OS: Debian 11
  • Netbox agent: installed from git+github_url

Additional context
Launching a register with: netbox_agent -c /etc/netbox_agent.yml --register --debug --force-disk-refresh did not help

@Solvik
Copy link
Owner

Solvik commented Aug 28, 2023

Netbox doesn't allow null serial numbers

Could you paste your dmidecode output so I can understand why it's trying to create a ressource without S/N?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants