Skip to content
Snippets Groups Projects
Commit 4b90d703 authored by Stéphane Diemer's avatar Stéphane Diemer
Browse files

Fixed DNS test.

parent 8806b046
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,7 @@ GREEN = '\033[92m'
RED = '\033[91m'
DEF = '\033[0m'
def get_dns_servers():
servers = list()
with open('/etc/resolv.conf', 'r') as f:
......@@ -24,11 +25,13 @@ def get_dns_servers():
resolvers = get_dns_servers()
def get_result(output):
for line in output.split('\n'):
if "has address " in line:
return line.split("has address ")[1]
def check_dns(hostname, expected_ip):
all_ok = True
for resolver in resolvers:
......@@ -48,6 +51,8 @@ def check_dns(hostname, expected_ip):
print('%sDNS resolution of %s on server %s returned %s%s' % (color, hostname, resolver, address, DEF))
return all_ok
os.chdir(os.path.dirname(__file__))
if os.path.isfile('../utils.py'):
all_ok = True
es_utils = imp.load_source('es_utils', '../utils.py')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment