better tls zone calculation

This commit is contained in:
egarette@silique.fr 2023-07-31 18:45:36 +02:00
parent 6d8219b22c
commit 1ce00d81cb

View file

@ -332,10 +332,9 @@ class Loader:
""") """)
def add_tls(self): def add_tls(self):
zones = set()
dns_module_name = None dns_module_name = None
for host in self.servers_json['hosts'].values(): for host in self.servers_json['hosts'].values():
zones = [self.servers_json['zones']['external_zone'], None] zones = [self.servers_json['zones']['external_zone']]
for server_name, datas in host['servers'].items(): for server_name, datas in host['servers'].items():
if not 'applicationservice' in datas: if not 'applicationservice' in datas:
raise Exception(f'cannot find applicationservice for "{server_name}"') raise Exception(f'cannot find applicationservice for "{server_name}"')
@ -346,13 +345,10 @@ class Loader:
if dns_module_name: if dns_module_name:
break break
zones[1] = datas['provider_zone'] zones[1] = datas['provider_zone']
if None in zones: if zones[0] == zones[1]:
zones = [] zones = [zones[0]]
else:
if zones[0] == zones[1]:
zones = [zones[0]]
host['servers']['tls'] = {'applicationservice': 'tls', host['servers']['tls'] = {'applicationservice': 'tls',
'zones_name': list(zones), 'zones_name': zones,
} }
def load_dictionaries(self, cfg, module_info, server_name, rougail): def load_dictionaries(self, cfg, module_info, server_name, rougail):