@!@
ROLES = {
    "domaincontroller_master": "Univention Primary Directory Node",
    "domaincontroller_slave": "Univention Replica Directory Node",
    "domaincontroller_backup": "Univention Backup Directory Node",
    "memberserver": "Univention Managed Node",
}


def alpha_warning(details: bool = True) -> str:
    version = configRegistry.get('version/alpha')
    if not version:
        return ''
    title = '!!!  UCS %s ALPHA  DO NOT USE IN PRODUCTION  !!!' % (version,)
    box = ['#' * 78, '##%s##' % (' ' * 74,), '##%s##' % (title.center(74),), '##%s##' % (' ' * 74,), '#' * 78]
    text = '%s\n' % ('\n'.join(box),)
    if details:
        text += '''
This is an early Alpha version of Univention Corporate Server (UCS) 5.3, meant
exclusively for evaluation and early testing:

 - Do NOT use this system in production.
 - There is NO upgrade path from this Alpha version to the final release. A
   reinstallation will be required.
 - This system uses UCS testing repositories. Updates may temporarily or
   permanently render the system unusable.
 - No support is provided for Alpha installations.
'''
    return text + '\n'


print(alpha_warning(details=False), end='')

role = configRegistry.get('server/role')
menutitle = ROLES.get(role, "Univention Corporate Server")

if configRegistry.get('version/version'):
    print('%s %s-%s:' % (menutitle, configRegistry.get('version/version'), configRegistry.get('version/patchlevel')))
else:
    print(menutitle)

if role in ROLES:
    print('')
    startsite = ""
    host = configRegistry.get('hostname')
    domain = configRegistry.get('domainname')

    if host and domain:
        startsite = "%s.%s/" % (host, domain)

    from univention.config_registry.interfaces import Interfaces
    address = Interfaces(configRegistry).get_default_ip_address()
    if address:
        ip = str(address.ip)
        if ip:
            startsite = "%s (%s)" % (startsite, ip)

    if role == 'domaincontroller_master':
        print('The UCS management system is available at https://' + startsite)
    else:
        print('The UCS management system can be reached by following the link to the Primary Directory')
        print('Node at https://' + startsite + ' and selecting the')
        print('Univention Management Console.')

    print('')
    print('You can log into the Univention Management Console - the main tool to manage ')
    print('users, groups, etc. - using the "Administrator" account and the password selected ')
    print('for the root user on the Primary Directory Node.')
@!@

