@%@UCRWARNING=# @%@

@!@
servers = []
timeserver = configRegistry.get('timeserver')
if timeserver != 'local':
    # Expect on the Primary Directory Node, add Primary Directory Node and all other Backup Directory Nodes as timeserver
    role = configRegistry.get('server/role')
    dcs = [_f for _f in [configRegistry.get('ldap/master')] + configRegistry.get('ldap/backup', '').split(' ') if _f]
    if role != "domaincontroller_master":
        fqdn = '%(hostname)s.%(domainname)s' % configRegistry
        servers.extend([dc for dc in dcs if dc != fqdn])
    # Always add the explicitly configured time servers
    for ts in [timeserver] + [configRegistry.get('timeserver%d' % d) for d in range(2, 4)]:
        if ts and ts not in dcs:
            servers.append(ts)
if servers:
    print('NTPSERVERS="%s"' % ' '.join(servers))
@!@
