fabfile.py 文件源码

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

项目:fabricio 作者: renskiy 项目源码 文件源码
def swarm_init():
    """
    enable Docker swarm mode
    """
    def _swarm_init():
        if swarm_init.worker_join_command is None:
            fabricio.run(
                'docker swarm init --advertise-addr {0}'.format(fab.env.host),
                ignore_errors=True,
            )
            join_token = fabricio.run(
                'docker swarm join-token --quiet manager',
                ignore_errors=True,
            )
            swarm_init.worker_join_command = (
                'docker swarm join --token {join_token} {host}:2377'
            ).format(join_token=join_token, host=fab.env.host)
        else:
            fabricio.run(
                swarm_init.worker_join_command,
                ignore_errors=True,
            )
    with fab.settings(hosts=hosts):
        fab.execute(_swarm_init)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号