run.py 文件源码

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

项目:bay 作者: eventbrite 项目源码 文件源码
def shell(app, container, host, command):
    """
    Runs a single container with foreground enabled and overridden to use bash.
    """
    # Get the current formation
    formation = FormationIntrospector(host, app.containers).introspect()
    # Make a Formation with that container launched with bash in foreground
    try:
        instance = formation.add_container(container, host)
    except ImageNotFoundException as e:
        click.echo(RED(str(e)))
        sys.exit(1)
    instance.foreground = True
    if command:
        instance.command = ['/bin/bash -lc "{}"'.format(' '.join(command))]
    else:
        instance.command = ["/bin/bash -l"]
    # Run that change
    task = Task("Shelling into {}".format(container.name), parent=app.root_task)
    run_formation(app, host, formation, task)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号