Exemplo n.º 1
0
    def kt_fwd(ctx, treadmill_id, run):
        """Installs Treadmill keytab fwd server.
        """
        dst_dir = ctx.obj['PARAMS']['dir']
        profile = ctx.obj['PARAMS'].get('profile')

        run_script = None
        if run:
            run_script = os.path.join(dst_dir, 'bin', 'run.sh')

        if treadmill_id:
            ctx.obj['PARAMS']['treadmillid'] = treadmill_id

        if not ctx.obj['PARAMS'].get('treadmillid'):
            raise click.UsageError(
                '--treadmill-id is required, '
                'unable to derive treadmill-id from context.')

        bs_install.install(
            'kt-fwd',
            dst_dir,
            ctx.obj['PARAMS'],
            run=run_script,
            profile=profile,
        )
Exemplo n.º 2
0
    def spawn(ctx, treadmill_id, run):
        """Installs Treadmill spawn."""
        ctx.obj['PARAMS']['zookeeper'] = context.GLOBAL.zk.url
        ctx.obj['PARAMS']['ldap'] = context.GLOBAL.ldap.url

        dst_dir = ctx.obj['PARAMS']['dir']
        profile = ctx.obj['PARAMS'].get('profile')

        bs_install.wipe(os.path.join(dst_dir, 'wipe_me'),
                        os.path.join(dst_dir, 'bin', 'wipe_spawn.sh'))

        run_script = None
        if run:
            run_script = os.path.join(dst_dir, 'bin', 'run.sh')

        if treadmill_id:
            ctx.obj['PARAMS']['treadmillid'] = treadmill_id

        if not ctx.obj['PARAMS'].get('treadmillid'):
            raise click.UsageError(
                '--treadmill-id is required, '
                'unable to derive treadmill-id from context.')

        bs_install.install(
            'spawn',
            dst_dir,
            ctx.obj['PARAMS'],
            run=run_script,
            profile=profile,
        )
Exemplo n.º 3
0
    def node(ctx, run, benchmark, runtime=None, runtime_param=None):
        """Installs Treadmill node."""
        dst_dir = ctx.obj['PARAMS']['dir']
        profile = ctx.obj['PARAMS'].get('profile')

        if runtime is not None:
            ctx.obj['PARAMS']['treadmill_runtime'] = runtime

        ctx.obj['PARAMS']['treadmill_runtime_param'] = runtime_param

        if os.name == 'nt':
            wipe_script = [
                'powershell.exe', '-file',
                os.path.join(dst_dir, 'bin', 'wipe_node.ps1')
            ]
        else:
            wipe_script = os.path.join(dst_dir, 'bin', 'wipe_node.sh')

        bs_install.wipe(
            os.path.join(dst_dir, 'wipe_me'),
            wipe_script
        )

        run_script = None

        # FIXME: Disabled benchmark for now to remove dependency on LDAP during
        #        node start.
        # admin_cell = admin.Cell(context.GLOBAL.ldap.conn)
        # cell_config = admin_cell.get(context.GLOBAL.cell)
        # ctx.obj['PARAMS']['benchmark'] = cell_config.get(
        #     'data', {}
        # ).get('benchmark', None)
        ctx.obj['PARAMS']['zookeeper'] = context.GLOBAL.zk.url
        ctx.obj['PARAMS']['ldap'] = context.GLOBAL.ldap.url

        if benchmark:
            if os.name == 'posix':
                run_script = os.path.join(dst_dir, 'bin', 'benchmark.sh')
        else:
            if run:
                if os.name == 'nt':
                    run_script = [
                        'powershell.exe', '-file',
                        os.path.join(dst_dir, 'bin', 'run.ps1')
                    ]
                else:
                    run_script = os.path.join(dst_dir, 'bin', 'run.sh')

        bs_install.install(
            'node',
            dst_dir,
            ctx.obj['PARAMS'],
            run=run_script,
            profile=profile,
        )
Exemplo n.º 4
0
    def openldap(ctx, gssapi, rootpw, owner, suffix, uri, masters, first_time,
                 run, env, ldap_admins):
        """Installs Treadmill Openldap server."""
        dst_dir = ctx.obj['PARAMS']['dir']
        profile = ctx.obj['PARAMS'].get('profile')

        run_script = None
        if run:
            run_script = os.path.join(dst_dir, 'bin', 'run.sh')

        ctx.obj['PARAMS']['env'] = env
        ctx.obj['PARAMS']['treadmillid'] = owner

        if uri:
            ctx.obj['PARAMS']['uri'] = uri
            if masters and uri in masters:
                ctx.obj['PARAMS']['is_master'] = True
        if rootpw:
            ctx.obj['PARAMS']['rootpw'] = rootpw
        if gssapi:
            ctx.obj['PARAMS']['gssapi'] = gssapi
            ctx.obj['PARAMS']['rootpw'] = ''
        if masters:
            ctx.obj['PARAMS']['masters'] = masters
        else:
            ctx.obj['PARAMS']['masters'] = []

        if ldap_admins:
            ldap_admins.append(owner)
            ctx.obj['PARAMS']['ldap_admins'] = ','.join(set(ldap_admins))
        else:
            ctx.obj['PARAMS']['ldap_admins'] = owner

        if first_time:
            ctx.obj['PARAMS']['first_time'] = first_time

        if suffix:
            ctx.obj['PARAMS']['suffix'] = suffix
        else:
            ctx.obj['PARAMS']['suffix'] = context.GLOBAL.ldap_suffix

        bs_install.install(
            'openldap',
            dst_dir,
            ctx.obj['PARAMS'],
            run=run_script,
            profile=profile,
        )
Exemplo n.º 5
0
    def tkt_fwd(ctx, run):
        """Installs Treadmill tkt-fwd server.
        """
        dst_dir = ctx.obj['PARAMS']['dir']
        profile = ctx.obj['PARAMS'].get('profile')

        run_script = None
        if run:
            run_script = os.path.join(dst_dir, 'bin', 'run.sh')

        bs_install.install(
            'tkt-fwd',
            dst_dir,
            ctx.obj['PARAMS'],
            run=run_script,
            profile=profile,
        )
Exemplo n.º 6
0
    def tkt_fwd(ctx, run):
        """Installs Treadmill tkt-fwd server.
        """
        dst_dir = ctx.obj['PARAMS']['dir']
        profile = ctx.obj['PARAMS'].get('profile')

        run_script = None
        if run:
            run_script = os.path.join(dst_dir, 'bin', 'run.sh')

        locker_scandir = os.path.join(dst_dir, 'lockers', '*')
        for locker in glob.glob(locker_scandir):
            _LOGGER.info('Removing: %s', locker)
            shutil.rmtree(locker)

        bs_install.install(
            'tkt-fwd',
            dst_dir,
            ctx.obj['PARAMS'],
            run=run_script,
            profile=profile,
        )
Exemplo n.º 7
0
    def zookeeper(ctx, run, master_id, data_dir, zk_admins):
        """Installs Treadmill master."""

        ctx.obj['PARAMS']['zookeeper'] = context.GLOBAL.zk.url
        ctx.obj['PARAMS']['ldap'] = context.GLOBAL.ldap.url
        ctx.obj['PARAMS']['master_id'] = master_id

        realms = krb5.get_host_realm(sysinfo.hostname())
        if realms:
            ctx.obj['PARAMS']['krb_realm'] = realms[0]

        if data_dir:
            ctx.obj['PARAMS']['data_dir'] = data_dir
        dst_dir = ctx.obj['PARAMS']['dir']
        profile = ctx.obj['PARAMS'].get('profile')

        for master in ctx.obj['PARAMS']['masters']:  # pylint: disable=E1136
            if int(master['idx']) == int(master_id):
                ctx.obj['PARAMS'].update({'me': master})

        run_sh = None
        if run:
            run_sh = os.path.join(dst_dir, 'treadmill', 'bin', 'run.sh')

        if zk_admins:
            zk_admins.append(ctx.obj['PARAMS']['treadmillid'])
            ctx.obj['PARAMS']['zk_admins'] = ','.join(set(zk_admins))
        else:
            ctx.obj['PARAMS']['zk_admins'] = ctx.obj['PARAMS']['treadmillid']

        bs_install.install(
            'zookeeper',
            dst_dir,
            ctx.obj['PARAMS'],
            run=run_sh,
            profile=profile,
        )
Exemplo n.º 8
0
    def master(ctx, run, master_id):
        """Installs Treadmill master."""

        ctx.obj['PARAMS']['zookeeper'] = context.GLOBAL.zk.url
        ctx.obj['PARAMS']['ldap'] = context.GLOBAL.ldap.url
        ctx.obj['PARAMS']['master_id'] = master_id
        dst_dir = ctx.obj['PARAMS']['dir']
        profile = ctx.obj['PARAMS'].get('profile')

        for master in ctx.obj['PARAMS']['masters']:  # pylint: disable=E1136
            if int(master['idx']) == int(master_id):
                ctx.obj['PARAMS'].update({'me': master})

        run_sh = None
        if run:
            run_sh = os.path.join(dst_dir, 'treadmill', 'bin', 'run.sh')

        bs_install.install(
            'master',
            dst_dir,
            ctx.obj['PARAMS'],
            run=run_sh,
            profile=profile,
        )