From de88ca85b974dffe883346dbf0d67cd4ef960269 Mon Sep 17 00:00:00 2001 From: clbu Date: Wed, 16 Oct 2024 10:54:40 +0200 Subject: [PATCH] fix(network): use netifaces2 --- netbox_agent/network.py | 4 ++-- requirements.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/netbox_agent/network.py b/netbox_agent/network.py index 41db084..a303a83 100644 --- a/netbox_agent/network.py +++ b/netbox_agent/network.py @@ -81,7 +81,7 @@ class Network(object): # for addr in ip6_addr: addr["addr"] = addr["addr"].replace('%{}'.format(interface), '') - addr["netmask"] = addr["netmask"].split('/')[0] + addr["mask"] = addr["mask"].split('/')[0] ip_addr.append(addr) mac = open('/sys/class/net/{}/address'.format(interface), 'r').read().strip() @@ -109,7 +109,7 @@ class Network(object): 'ip': [ '{}/{}'.format( x['addr'], - IPAddress(x['netmask']).netmask_bits() + IPAddress(x['mask']).netmask_bits() ) for x in ip_addr ] if ip_addr else None, # FIXME: handle IPv6 addresses 'ethtool': Ethtool(interface).parse(), diff --git a/requirements.txt b/requirements.txt index 1d5cb4d..f0c1dc2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ pynetbox==7.3.4 netaddr==1.3.0 -netifaces==0.11.0 +netifaces2==0.0.22 pyyaml==6.0.1 jsonargparse==4.32.0 python-slugify==8.0.4