diff --git a/tests/test_nginx_vhosts.py b/tests/test_nginx_vhosts.py index cc9aef5685000a0fce4f59dddb497b17c47d2bec..c635ca1c5635302be55e2f3700ed2bf543ae35fe 100755 --- a/tests/test_nginx_vhosts.py +++ b/tests/test_nginx_vhosts.py @@ -39,18 +39,18 @@ if os.path.isfile('../utils.py'): es_utils = imp.load_source('es_utils', '../utils.py') conf = es_utils.load_conf() +# get celerity conf +celerity_conf = '' +if os.path.exists('/etc/celerity/config.py'): + with open('/etc/celerity/config.py', 'r') as fo: + celerity_conf = fo.read() + # get enabled vhosts resolution_ignored = conf.get('TESTER_VHOST_RESOLUTION_IGNORED', '').split(',') requests.packages.urllib3.disable_warnings() found = False errors = 0 warnings = False - -def check_celerity_conf(url): - with open('/etc/celerity/config.py', 'r') as f: - d = f.read() - return url in d - for name in os.listdir(nginx_dir): path = os.path.join(nginx_dir, name) with open(path, 'r') as fo: @@ -69,10 +69,10 @@ for name in os.listdir(nginx_dir): continue # status vhost found = True url = '%s://%s' % ('https' if https else 'http', domain) - if name.startswith('mediaserver') and not check_celerity_conf(url): - sys.stdout.write('Url %s not found in celerity conf; is should also be set in the MediaWorker\n' % url) - warnings = True sys.stdout.write('Testing url "%s":\n' % url) + if name.startswith('mediaserver') and url not in celerity_conf: + sys.stdout.write('Url "%s" not found in celerity conf; it should also be set in the MediaWorker.\n' % url) + warnings = True # test domain IP ip_error = None try: