def run_setup()

in assets/scripts/SilentInstaller.py [0:0]


def run_setup(options, secrets, package_version):
    ''' Runs a sequence of tsm commands to perform setup '''

    tsm_path = os.path.join(options.installDir, 'packages', 'bin.' + package_version, 'tsm.cmd')
    tabcmd_path = os.path.join(options.installDir, 'packages', 'bin.' + package_version, 'tabcmd.exe')

    port = options.controllerPort

    # activate a trial and/or any license keys specified in the secrets file
    product_keys = secrets.get('product_keys')
    if (isinstance(product_keys, list)):
        if ('trial' in product_keys):
            run_tsm_command(tsm_path, secrets, ['licenses','activate', '--trial'], port)
            print('Activated trial')
        for productKey in product_keys:
            if (len(productKey) > 0 and productKey != 'trial'):
                run_tsm_command(tsm_path, secrets, ['licenses','activate', '--license-key', productKey], port)
                print('Activated license key: ' + productKey)

    run_tsm_command(tsm_path, secrets, ['register', '--file', options.registrationFile], port)
    if options.saveNodeConfiguration == 'yes':
        run_tsm_command(tsm_path, secrets, ['topology', 'nodes', 'get-bootstrap-file', '--file', options.nodeConfigurationDirectory], port)
        print('Node configuration file saved.')
    run_tsm_command(tsm_path, secrets, ['settings', 'import', '--config-only', '-f', options.configFile], port)
    print('Configuration settings imported')
    run_tsm_command(tsm_path, secrets, ['pending-changes', 'apply', '--ignore-prompt', '--ignore-warnings'], port)
    print('Configuration applied')
    run_tsm_command(tsm_path, secrets, ['initialize', '--request-timeout', '7200'], port)
    print('Initialization completed')
    get_nodes_and_apply_topology(options.configFile, tsm_path, secrets, port)
    run_tsm_command(tsm_path, secrets, ['pending-changes', 'apply', '--ignore-prompt', '--ignore-warnings'], port)
    print('Topology applied')
    if options.start == 'yes':
        run_tsm_command(tsm_path, secrets, ['start', '--request-timeout', '1800'], port)
        print('Server is installed and running')
        run_tabcmd_command(tabcmd_path, ['initialuser', '--server', 'localhost:'+str(getGatewayPort(options.configFile)), '--username', secrets['content_admin_user'], '--password', secrets['content_admin_pass']])
        print('Initial admin created')
    print('Installation complete')