master.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:treadmill 作者: Morgan-Stanley 项目源码 文件源码
def init():
    """Return top level command handler."""

    @click.command()
    @click.option('--run/--no-run', is_flag=True, default=False)
    @click.option('--master-id', required=True,
                  type=click.Choice(['1', '2', '3']))
    @click.option('--ldap-pwd',
                  help='LDAP password (clear text of path to file).')
    @click.pass_context
    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,
        )

    return master
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号