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

Added a conf to ignore domain resolution check (refs #20802).

parent 75fa2f0a
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@
Criticality: High
Tests that all webserver services (vhosts) are available and reachable.
'''
import imp
import os
import re
import requests
......@@ -31,23 +32,31 @@ if not os.path.exists(wowza_dir):
else:
print('Info: Wowza is installed, /streaming/ will be tested on mediaserver vhosts.')
# get envsetup conf
conf = dict()
os.chdir(os.path.dirname(__file__))
if os.path.isfile('../utils.py'):
es_utils = imp.load_source('es_utils', '../utils.py')
conf = es_utils.load_conf()
# get enabled vhosts
resolution_ignored = conf.get('TESTER_VHOST_RESOLUTION_IGNORED', '').split(',')
requests.packages.urllib3.disable_warnings()
found = False
errors = 0
for name in os.listdir(nginx_dir):
path = os.path.join(nginx_dir, name)
with open(path, 'r') as fo:
conf = fo.read()
conf = conf.replace('\t', ' ')
matching = re.search(r'.*server_name\ +([0-9a-zA-Z\.\-\_\ ]+);.*', conf)
vhost = fo.read()
vhost = vhost.replace('\t', ' ')
matching = re.search(r'.*server_name\ +([0-9a-zA-Z\.\-\_\ ]+);.*', vhost)
if not matching:
print('The server_name was not found in: "%s".' % path)
errors += 1
continue
domains = matching.groups()[0].strip().split(' ')
https = re.search(r'listen +\w* +ssl;', conf) is not None \
or re.search(r'ssl +on;', conf) is not None
https = re.search(r'listen +\w* +ssl;', vhost) is not None \
or re.search(r'ssl +on;', vhost) is not None
for domain in domains:
if domain == 'localhost':
continue # status vhost
......@@ -65,7 +74,11 @@ for name in os.listdir(nginx_dir):
ip_error = 'domain is resolved with %s instead of 127.0.0.1' % ip
sys.stdout.write(' IP: ')
if ip_error:
sys.stdout.write('\033[91mKO (%s)\033[0m' % ip_error)
if domain in resolution_ignored:
sys.stdout.write('\033[94mIgnored (%s)\033[0m' % ip_error)
ip_error = None
else:
sys.stdout.write('\033[91mKO (%s)\033[0m' % ip_error)
else:
sys.stdout.write('\033[92mOK (127.0.0.1)\033[0m')
# test url
......
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