Merge pull request #6 from micw/log-failed-dns

Add logging for failed DNS lookups
main
Dimitri Huisman 2 years ago committed by Alexander Graf
parent f63837b8e1
commit c0066abd01
No known key found for this signature in database
GPG Key ID: B8A9DC143E075629

@ -1,7 +1,7 @@
import socket
import tenacity
from os import environ
import logging as log
@tenacity.retry(stop=tenacity.stop_after_attempt(100),
wait=tenacity.wait_random(min=2, max=5))
@ -9,7 +9,11 @@ def resolve_hostname(hostname):
""" This function uses system DNS to resolve a hostname.
It is capable of retrying in case the host is not immediately available
"""
try:
return socket.gethostbyname(hostname)
except Exception as e:
log.warn("Unable to lookup '%s': %s",hostname,e)
raise e
def resolve_address(address):

Loading…
Cancel
Save