diff --git a/prometheuspvesd/discovery.py b/prometheuspvesd/discovery.py index e778fa5..8070cb0 100644 --- a/prometheuspvesd/discovery.py +++ b/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: diff --git a/prometheuspvesd/test/fixtures/fixtures.py b/prometheuspvesd/test/fixtures/fixtures.py index f6e0370..6949dc0 100644 --- a/prometheuspvesd/test/fixtures/fixtures.py +++ b/prometheuspvesd/test/fixtures/fixtures.py @@ -350,6 +350,10 @@ def networks(): "tx-packets": 14423878 } }, + { + "hardware-address": "ba:97:85:bd:9a:a5", + "name": "eth1" + }, ]