mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
fix #21397 - force glibc to re-read resolv.conf
This commit is contained in:
parent
51c662bcf1
commit
f6a81da16f
@ -96,6 +96,15 @@ try:
|
||||
except ImportError:
|
||||
HAS_SETPROCTITLE = False
|
||||
|
||||
try:
|
||||
import ctypes
|
||||
import ctypes.util
|
||||
libc = ctypes.cdll.LoadLibrary(ctypes.util.find_library("c"))
|
||||
res_init = libc.__res_init
|
||||
HAS_RESINIT = True
|
||||
except:
|
||||
HAS_RESINIT = False
|
||||
|
||||
# Import salt libs
|
||||
import salt._compat
|
||||
import salt.exitcodes
|
||||
@ -518,6 +527,9 @@ def dns_check(addr, safe=False, ipv6=False):
|
||||
'''
|
||||
error = False
|
||||
try:
|
||||
# issue #21397: force glibc to re-read resolv.conf
|
||||
if HAS_RESINIT:
|
||||
res_init()
|
||||
hostnames = socket.getaddrinfo(
|
||||
addr, None, socket.AF_UNSPEC, socket.SOCK_STREAM
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user