packer.py 文件源码

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

项目:builder 作者: elifesciences 项目源码 文件源码
def install_box(pname):
    """alternative to 'vagrant add boxname'.
    downloads and installs a vagrant box.
    macs appear to have a problem maintaining a connection to S3,
    so this task downloads it for Vagrant and then adds it from the filesystem"""
    if box_installed(pname):
        print 'the .box file for %r has already been installed (%s)' % (pname, prj(pname, 'vagrant.box'))
        return
    dest = download_box(pname)
    with settings(warn_only=True):
        cmd = "vagrant box add %s %s" % (prj(pname, 'vagrant.box'), dest)
        retval = local(cmd).return_code
        if retval == 0 and os.path.exists(dest):
            print 'removing downloaded file ...'
            local('rm -i %s' % dest)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号