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

Do not test DNS of non installed services (refs #24569).

parent a82a7148
No related branches found
No related tags found
No related merge requests found
......@@ -85,24 +85,24 @@ if not ip or ip == '0':
print('No IP set in configuration file, unable to test DNS.')
sys.exit(2)
conf_servers = (
'MS_SERVER_NAME',
'MONITOR_SERVER_NAME',
'CM_SERVER_NAME',
services_info = (
('MS_SERVER_NAME', 'mediaserver', 'python3-mediaserver'),
('MONITOR_SERVER_NAME', 'monitor', 'python3-mediaserver-monitor'),
('CM_SERVER_NAME', 'campusmanager', 'campus-manager'),
)
conf_server_defaults = (
'mediaserver',
'monitor',
'campusmanager',
)
for s in conf_servers:
hostname = conf.get(s)
if hostname not in conf_server_defaults:
ok = check_dns(hostname, ip)
if not ok:
all_ok = False
for conf_name, default_domain, package in services_info:
domain = conf.get(conf_name)
if domain and domain != default_domain:
# check that the service is installed on this system
status, output = subprocess.getstatusoutput('dpkg -s %s' % package)
if status == 0:
print('Checking IP of "%s".' % domain)
ok = check_dns(domain, ip)
if not ok:
all_ok = False
else:
print('Package %s is not installed, IP of "%s" will not be checked.' % (package, domain))
if not all_ok:
sys.exit(1)
......
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