mirror of
https://github.com/thegeeklab/prometheus-pve-sd.git
synced 2024-11-22 01:10:39 +00:00
fix: fix error for interfaces without ip addresses (#200)
This commit is contained in:
parent
9968fdc9c4
commit
fb1f93b19c
@ -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
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…
Reference in New Issue
Block a user