mirror of
https://github.com/thegeeklab/prometheus-pve-sd.git
synced 2024-06-02 16:09:41 +02:00
fix: Only use ipv4 addresses for __meta_pve_ip
This commit is contained in:
parent
e16d6d795f
commit
233af09bd4
|
@ -87,7 +87,7 @@ class Discovery():
|
|||
|
||||
def _get_ip_address(self, pve_type, pve_node, vmid):
|
||||
|
||||
def validate(address):
|
||||
def validate_ipv4(address: object) -> object:
|
||||
try:
|
||||
# IP address validation
|
||||
if socket.inet_aton(address):
|
||||
|
@ -114,7 +114,8 @@ class Discovery():
|
|||
if type(networks) is list:
|
||||
for network in networks:
|
||||
for ip_address in network["ip-addresses"]:
|
||||
address = validate(ip_address["ip-address"])
|
||||
if ip_address['ip-address-type'] == 'ipv4':
|
||||
address = validate_ipv4(ip_address["ip-address"])
|
||||
|
||||
if not address:
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue
Block a user