better tls zone calculation

This commit is contained in:
egarette@silique.fr 2023-07-31 18:50:05 +02:00
parent 1ce00d81cb
commit 2edf4d2e86

View file

@ -334,7 +334,7 @@ class Loader:
def add_tls(self): def add_tls(self):
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']] zones = [self.servers_json['zones']['external_zone'], None]
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}"')
@ -345,8 +345,8 @@ class Loader:
if dns_module_name: if dns_module_name:
break break
zones[1] = datas['provider_zone'] zones[1] = datas['provider_zone']
if zones[0] == zones[1]: if zones[0] == zones[1] or not zones[1]:
zones = [zones[0]] zones.pop(1)
host['servers']['tls'] = {'applicationservice': 'tls', host['servers']['tls'] = {'applicationservice': 'tls',
'zones_name': zones, 'zones_name': zones,
} }