mirror of
https://github.com/thegeeklab/prometheus-pve-sd.git
synced 2024-11-22 09:20:41 +00:00
fix: stop ip address gathering after first found (#156)
This commit is contained in:
parent
fae8aaafbb
commit
573384e6dc
@ -109,14 +109,13 @@ class Discovery():
|
|||||||
except Exception: # noqa # nosec
|
except Exception: # noqa # nosec
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if networks:
|
|
||||||
if type(networks) is list:
|
if type(networks) is list:
|
||||||
for network in networks:
|
for network in networks:
|
||||||
for ip_address in network["ip-addresses"]:
|
for ip_address in network["ip-addresses"]:
|
||||||
if ip_address["ip-address-type"] == "ipv4":
|
if ip_address["ip-address-type"] == "ipv4" and not ipv4_address:
|
||||||
ipv4_address = validate_ip(ip_address["ip-address"])
|
ipv4_address = self._validate_ip(ip_address["ip-address"])
|
||||||
elif ip_address["ip-address-type"] == "ipv6":
|
elif ip_address["ip-address-type"] == "ipv6" and not ipv6_address:
|
||||||
ipv6_address = validate_ip(ip_address["ip-address"])
|
ipv6_address = self._validate_ip(ip_address["ip-address"])
|
||||||
|
|
||||||
if not ipv4_address:
|
if not ipv4_address:
|
||||||
try:
|
try:
|
||||||
@ -218,7 +217,7 @@ class Discovery():
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
metadata = {"notes": description}
|
metadata = {"notes": description}
|
||||||
|
|
||||||
ipv4_address, ipv6_address = self._get_ip_addresses(pve_type, node, vmid) or host
|
ipv4_address, ipv6_address = self._get_ip_addresses(pve_type, node, vmid)
|
||||||
|
|
||||||
prom_host = Host(vmid, host, ipv4_address, ipv6_address, pve_type)
|
prom_host = Host(vmid, host, ipv4_address, ipv6_address, pve_type)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user