- global packages update

- Use of netifaces2 + adaptation
This commit is contained in:
Grégoire Compagnon 2023-08-21 20:35:18 +02:00
parent 7ab7bbb9e1
commit 00b61e53e5
No known key found for this signature in database
GPG key ID: FCE2B21F080063F4
2 changed files with 16 additions and 9 deletions

View file

@ -81,7 +81,7 @@ class Network(object):
# #
for addr in ip6_addr: for addr in ip6_addr:
addr["addr"] = addr["addr"].replace('%{}'.format(interface), '') addr["addr"] = addr["addr"].replace('%{}'.format(interface), '')
addr["netmask"] = addr["netmask"].split('/')[0] addr["mask"] = addr["mask"].split('/')[0]
ip_addr.append(addr) ip_addr.append(addr)
mac = open('/sys/class/net/{}/address'.format(interface), 'r').read().strip() mac = open('/sys/class/net/{}/address'.format(interface), 'r').read().strip()
@ -109,7 +109,7 @@ class Network(object):
'ip': [ 'ip': [
'{}/{}'.format( '{}/{}'.format(
x['addr'], x['addr'],
IPAddress(x['netmask']).netmask_bits() IPAddress(x['mask']).netmask_bits()
) for x in ip_addr ) for x in ip_addr
] if ip_addr else None, # FIXME: handle IPv6 addresses ] if ip_addr else None, # FIXME: handle IPv6 addresses
'ethtool': Ethtool(interface).parse(), 'ethtool': Ethtool(interface).parse(),

View file

@ -1,8 +1,15 @@
pynetbox==6.1.2 certifi==2023.7.22
netaddr==0.8.0 charset-normalizer==3.2.0
netifaces==0.11.0
pyyaml==6.0.1
jsonargparse==3.11.2
python-slugify==8.0.1
packaging==23.1
distro==1.8.0 distro==1.8.0
idna==3.4
jsonargparse==4.23.1
netaddr==0.8.0
netifaces2==0.0.18
packaging==23.1
pynetbox==7.0.1
python-slugify==8.0.1
PyYAML==6.0.1
requests==2.31.0
text-unidecode==1.3
typing_extensions==4.7.1
urllib3==2.0.4