Skip to content

Commit

Permalink
fix: fix error for interfaces without ip addresses (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomsajan authored Apr 6, 2022
1 parent 9968fdc commit fb1f93b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion prometheuspvesd/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions prometheuspvesd/test/fixtures/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,10 @@ def networks():
"tx-packets": 14423878
}
},
{
"hardware-address": "ba:97:85:bd:9a:a5",
"name": "eth1"
},
]


Expand Down

0 comments on commit fb1f93b

Please sign in to comment.