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') bootstrap.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.') bootstrap.install( 'spawn', dst_dir, ctx.obj['PARAMS'], run=run_script, profile=profile, )
def zookeeper(ctx, run, master_id, data_dir): """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') bootstrap.install( 'zookeeper', dst_dir, ctx.obj['PARAMS'], run=run_sh, profile=profile, )
def node(ctx, run): """Installs Treadmill node.""" params = ctx.obj['PARAMS'] dst_dir = params['dir'] if os.name == 'nt': wipe_script = os.path.join(dst_dir, 'bin', 'wipe_node.cmd') else: wipe_script = os.path.join(dst_dir, 'bin', 'wipe_node.sh') bootstrap.wipe( os.path.join(dst_dir, 'wipe_me'), wipe_script ) run_script = None if run and os.name != 'nt': run_script = os.path.join(dst_dir, 'bin', 'run.sh') bootstrap.install( 'node', dst_dir, params, run=run_script ) # TODO: There is huge assymetry here, need to think how to # resolve this. if os.name == 'nt': run_script = os.path.join(dst_dir, 'bin', 'run.cmd') cmd = bootstrap.interpolate('{{ s6 }}\\winss-svscan.exe', params) arg = bootstrap.interpolate('{{ dir }}\\init', params) _set_env(dst_dir) # needed for winss-svscan os.chdir(arg) os.execvp(cmd, [arg])
def master(ctx, run, master_id, ldap_pwd): """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') if ldap_pwd: ctx.obj['PARAMS']['ldap_pwd'] = ldap_pwd 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') bootstrap.install( 'master', dst_dir, ctx.obj['PARAMS'], run=run_sh, profile=profile, )
def openldap(ctx, gssapi, rootpw, owner, suffix, uri, masters, run, enable_sasl, ldap_hostname): """Installs Treadmill Openldap server.""" dst_dir = ctx.obj['PARAMS']['dir'] run_script = None if run: run_script = os.path.join(dst_dir, 'bin', 'run.sh') if owner: ctx.obj['PARAMS']['owner'] = owner if uri: ctx.obj['PARAMS']['uri'] = uri 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 suffix: ctx.obj['PARAMS']['suffix'] = suffix if enable_sasl: ctx.obj['PARAMS']['enable_sasl'] = enable_sasl if ldap_hostname: ctx.obj['PARAMS']['ldap_hostname'] = ldap_hostname bootstrap.install( 'openldap', dst_dir, ctx.obj['PARAMS'], run=run_script )
def haproxy(ctx, run): """Installs Treadmill haproxy.""" dst_dir = ctx.obj['PARAMS']['dir'] _wipe(os.path.join(dst_dir, 'wipe_me'), os.path.join(dst_dir, 'bin', 'wipe_haproxy.sh')) run_script = None if run: run_script = os.path.join(dst_dir, 'bin', 'run.sh') bootstrap.install('haproxy', dst_dir, ctx.obj['PARAMS'], run=run_script)
def node(ctx, run, benchmark, runtime=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 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') bootstrap.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') bootstrap.install( 'node', dst_dir, ctx.obj['PARAMS'], run=run_script, profile=profile, )
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 bootstrap.install( 'openldap', dst_dir, ctx.obj['PARAMS'], run=run_script, profile=profile, )
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') bootstrap.install( 'tkt-fwd', dst_dir, ctx.obj['PARAMS'], run=run_script, profile=profile, )
def master(ctx, run, master_id, ldap_pwd): """Installs Treadmill master.""" ctx.obj['PARAMS']['master_id'] = master_id dst_dir = ctx.obj['PARAMS']['dir'] if ldap_pwd: ctx.obj['PARAMS']['ldap_pwd'] = ldap_pwd 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') bootstrap.install('master', dst_dir, ctx.obj['PARAMS'], run=run_sh)
def node(ctx, run, benchmark): """Installs Treadmill node.""" dst_dir = ctx.obj['PARAMS']['dir'] profile = ctx.obj['PARAMS'].get('profile') 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') bootstrap.wipe(os.path.join(dst_dir, 'wipe_me'), wipe_script) run_script = None if benchmark: if os.name == 'posix': run_script = os.path.join(dst_dir, 'bin', 'benchmark.sh') elif run: ctx.obj['PARAMS']['zookeeper'] = context.GLOBAL.zk.url ctx.obj['PARAMS']['ldap'] = context.GLOBAL.ldap.url if os.name == 'nt': run_script = [ 'powershell.exe', '-file', os.path.join(dst_dir, 'bin', 'run.ps1') ] else: 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) run_script = os.path.join(dst_dir, 'bin', 'run.sh') bootstrap.install( 'node', dst_dir, ctx.obj['PARAMS'], run=run_script, profile=profile, )