From c1b68103b9a92e0266c049c63724d374d09a3a09 Mon Sep 17 00:00:00 2001 From: Jan Tomsa Date: Tue, 5 Apr 2022 16:46:46 +0200 Subject: [PATCH 1/2] Work around interface without IP --- prometheuspvesd/discovery.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 @@ def _get_ip_addresses(self, pve_type, pve_node, vmid): 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: From c7a63fc6b0a213ae5d820ff3010c9ca744eabe35 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Wed, 6 Apr 2022 09:24:13 +0200 Subject: [PATCH 2/2] add testcase data --- prometheuspvesd/test/fixtures/fixtures.py | 4 ++++ 1 file changed, 4 insertions(+) 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" + }, ]