Browse Source

fix: fix error for interfaces without ip addresses (#200)

pull/205/head v2.5.1
Jan Tomsa 3 months ago committed by GitHub
parent
commit
fb1f93b19c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      prometheuspvesd/discovery.py
  2. 4
      prometheuspvesd/test/fixtures/fixtures.py

2
prometheuspvesd/discovery.py

@ -68,7 +68,7 @@ class Discovery():
if type(networks) is list:
for network in networks:
for ip_address in network["ip-addresses"]:
for ip_address in network.get("ip-addresses", []):
if ip_address["ip-address-type"] == "ipv4" and not ipv4_address:
ipv4_address = self._validate_ip(ip_address["ip-address"])
elif ip_address["ip-address-type"] == "ipv6" and not ipv6_address:

4
prometheuspvesd/test/fixtures/fixtures.py vendored

@ -350,6 +350,10 @@ def networks():
"tx-packets": 14423878
}
},
{
"hardware-address": "ba:97:85:bd:9a:a5",
"name": "eth1"
},
]

Loading…
Cancel
Save