LSHW.interfaces["name"] is a list instead of string #227

Closed
opened 2022-05-13 02:37:01 +02:00 by MatthewDZane · 1 comment
MatthewDZane commented 2022-05-13 02:37:01 +02:00 (Migrated from github.com)

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

**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](https://ubuntu.pkgs.org/20.04/ubuntu-main-amd64/lshw_02.18.85-0.3ubuntu2_amd64.deb.html)
AlexDaichendt commented 2023-04-06 13:12:56 +02:00 (Migrated from github.com)

I am encountering the same issue.

This should be handled by netbox-agent. I will submit a fix for this problem.

I am encountering the same issue. This should be handled by netbox-agent. I will submit a fix for this problem.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: DGNum/netbox-agent#227
No description provided.