netbox-agent
netbox-agent copied to clipboard
LSHW.interfaces["name"] is a list instead of string
Describe the bug
Traceback (most recent call last):
File "/usr/local/bin/netbox_agent", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.8/dist-packages/netbox_agent/cli.py", line 50, in main
return run(config)
File "/usr/local/lib/python3.8/dist-packages/netbox_agent/cli.py", line 43, in run
server.netbox_create_or_update(config)
File "/usr/local/lib/python3.8/dist-packages/netbox_agent/server.py", line 417, in netbox_create_or_update
self.inventory = Inventory(server=self)
File "/usr/local/lib/python3.8/dist-packages/netbox_agent/inventory.py", line 60, in __init__
self.lshw = LSHW()
File "/usr/local/lib/python3.8/dist-packages/netbox_agent/lshw.py", line 57, in __init__
self.walk_bridge(j)
File "/usr/local/lib/python3.8/dist-packages/netbox_agent/lshw.py", line 179, in walk_bridge
self.find_network(b)
File "/usr/local/lib/python3.8/dist-packages/netbox_agent/lshw.py", line 75, in find_network
unkn_intfs = [
File "/usr/local/lib/python3.8/dist-packages/netbox_agent/lshw.py", line 76, in <listcomp>
i for i in self.interfaces if i["name"].startswith("unknown")
i["name"] is a list of 2 strings, instead of being a string.
When running the lshw command, I see that on one section there are two consecutive "logical name: {name}" lines. Like so:
logical name: enp1s0f0
logical name: /dev/fb0
Also, could it be an issue with the lshw version? I am using Ubuntu 20.04 lshw 2.18.85-0.3
Expected behavior Ignore the second logical name and use only the first logical name in the i["name"] value.
Or
Ignore the second logical name from the lshw output so that i["name"] .
Note:
I'm not too familiar with Netbox and netbox-agent so these are just some suggestions to the issues I've run into. Ubuntu Main amd64 Official lshw_02.18.85-0.3ubuntu2_amd64.deb