Solvik / netbox-agent

Netbox agent to run on your infrastructure's servers
Apache License 2.0
287 stars 74 forks source link

lldm.py return error: current_dict[final] = value, TypeError #274

Closed Zagrebelsky closed 1 year ago

Zagrebelsky commented 1 year ago

Hi! It looks like there might be an issue when the path_component is already a string in the dictionary. When this happens, current_dict becomes a string, and then current_dict[final] = value, it throws the TypeError.

  File "/netbox_agent/lldp.py", line 45, in parse
    current_dict[final] = value

Expected behavior current_dict should always be dict, and not failed

Environment:

I prepared fix.

Thanks!

Solvik commented 1 year ago

Hi @Zagrebelsky

parsing LLDP output is quite tricky but your fix seems to do the trick!

it would be nice if you could open the PR so you can be the author and get the mentions! what do you think?

Zagrebelsky commented 1 year ago

Hi @Solvik, done https://github.com/Solvik/netbox-agent/pull/280

Solvik commented 1 year ago

Thanks !