Several minor fixes #47
No reviewers
Labels
No labels
help wanted
need testing
status: accepted
status: discussing
type: bug
type: documentation
type: duplicate
type: enhancement
type:hardware
type: invalid
type: major feature
type: minor feature
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: DGNum/netbox-agent#47
Loading…
Reference in a new issue
No description provided.
Delete branch "fixes-1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
raid_array check should return an empty array, not NoneType
not all systems will have IPv6 defined, so try to get the information.. if not
just continue on.
Vendor Supermicro was incomplete.
@ -63,1 +62,3 @@
ip_addr += netifaces.ifaddresses(interface).get(netifaces.AF_INET6)
ip_addr = netifaces.ifaddresses(interface).get(netifaces.AF_INET, [])
ip6_addr = netifaces.ifaddresses(interface).get(netifaces.AF_INET6, [])
or we could go:
Thanks for the PR !! I've added a single comment, the rest looks good to me :)
@ -63,1 +62,3 @@
ip_addr += netifaces.ifaddresses(interface).get(netifaces.AF_INET6)
ip_addr = netifaces.ifaddresses(interface).get(netifaces.AF_INET, [])
ip6_addr = netifaces.ifaddresses(interface).get(netifaces.AF_INET6, [])
@ -63,1 +62,3 @@
ip_addr += netifaces.ifaddresses(interface).get(netifaces.AF_INET6)
ip_addr = netifaces.ifaddresses(interface).get(netifaces.AF_INET, [])
ip6_addr = netifaces.ifaddresses(interface).get(netifaces.AF_INET6, [])
Oh, wait, I found the problem.. both need the [] ; but that causes another problem.
{17: [{'addr': '0c:c4:7a:59:ec:4a', 'broadcast': 'ff:ff:ff:ff:ff:ff'}], 10: [{'addr': 'fe80::ec4:7aff:fe59:ec4a%eno1', 'netmask': 'ffff:ffff:ffff:ffff::/64'}]}
ip_addr= []
Traceback (most recent call last):
File "/usr/local/bin/netbox_agent", line 11, in
load_entry_point('netbox-agent==0.1', 'console_scripts', 'netbox_agent')()
File "/usr/local/lib/python3.6/site-packages/netbox_agent-0.1-py3.6.egg/netbox_agent/cli.py", line 41, in main
return run(args)
File "/usr/local/lib/python3.6/site-packages/netbox_agent-0.1-py3.6.egg/netbox_agent/cli.py", line 27, in run
server.netbox_update()
File "/usr/local/lib/python3.6/site-packages/netbox_agent-0.1-py3.6.egg/netbox_agent/server.py", line 275, in netbox_update
self.network = Network(server=self)
File "/usr/local/lib/python3.6/site-packages/netbox_agent-0.1-py3.6.egg/netbox_agent/network.py", line 49, in init
self.scan()
File "/usr/local/lib/python3.6/site-packages/netbox_agent-0.1-py3.6.egg/netbox_agent/network.py", line 90, in scan
] if ip_addr else None, # FIXME: handle IPv6 addresses
File "/usr/local/lib/python3.6/site-packages/netbox_agent-0.1-py3.6.egg/netbox_agent/network.py", line 89, in
) for x in ip_addr
File "/usr/local/lib/python3.6/site-packages/netaddr-0.7.19-py3.6.egg/netaddr/ip/init.py", line 280, in init
% self.class.name)
ValueError: IPAddress() does not support netmasks or subnet prefixes! See documentation for details.
@ -63,1 +62,3 @@
ip_addr += netifaces.ifaddresses(interface).get(netifaces.AF_INET6)
ip_addr = netifaces.ifaddresses(interface).get(netifaces.AF_INET, [])
ip6_addr = netifaces.ifaddresses(interface).get(netifaces.AF_INET6, [])
works like a charm on a VM without any IPs, not your case?
I've updated the pull, fixes the IPv6 subnet problem which was crashing IPAddress (netifaces returns an IPv6 netmask that netaddr does not understand) It now works for me!
@ -59,8 +59,29 @@ class Network():
logging.debug('Ignore interface {interface}'.format(interface=interface))
ip6_addr
isn't defined, we cant+=
I've tried to reproduce this case during my testing, but it was unsuccessful. It's good you caught this!
We should do the same thing for
addr
and remove%.*
no ?@ -59,8 +59,29 @@ class Network():
logging.debug('Ignore interface {interface}'.format(interface=interface))
ok you've just fixed that :)
@ -59,8 +59,29 @@ class Network():
logging.debug('Ignore interface {interface}'.format(interface=interface))
yup. once you fix the netmask and ipv6 address, it goes right in.
So, it should be ready - ipv6 addresses now work correctly, and are even registered correctly to the interface.
@ -59,8 +59,29 @@ class Network():
logging.debug('Ignore interface {interface}'.format(interface=interface))
There's still the following error:
Just add this and it'll be good to go!
@ -59,8 +59,29 @@ class Network():
logging.debug('Ignore interface {interface}'.format(interface=interface))
pushed up a fix.