【问题标题】:Is it possible to check via a script whether a Vagrant box is out of date?是否可以通过脚本检查 Vagrant 框是否已过时?
【发布时间】:2016-03-11 16:15:19
【问题描述】:

我的团队正在使用 Vagrant,每当有新盒子出现时,我们都希望更新以保持最新状态。我们并不担心新版本的盒子会成为问题。

因此,我希望创建一个脚本(在 Windows 和 Mac 上,是的,它可能是不同的格式,但想法保持不变)将检查更新并在它们存在时应用它们。

我的意思是我想让我的团队运行一些东西,比如 vagrant_launch.sh 就可以了

if box is out of date:
    update the box
vagrant up

这可能是if box is out of date: 部分吗?

【问题讨论】:

    标签: windows macos scripting vagrant


    【解决方案1】:

    您可以在特定的 Vagrantfile 上运行 vagrant box outdated 以检查该文件是否已过时。

    你也可以运行vagrant box outdated --global来检查你已经安装的所有盒子,例如

    fhenri@machine:~$ vagrant box outdated --global
    * 'windows_ie' wasn't added from a catalog, no version information
    * 'ubuntu/trusty64' is outdated! Current: 20151117.0.0. Latest: 20151201.0.0
    * 'ubuntu-12.04' wasn't added from a catalog, no version information
    * 'puphpet/centos65-x64' is outdated! Current: 2.0. Latest: 20151130
    * 'hashicorp/boot2docker' (v1.7.8) is up to date
    * 'centos65' wasn't added from a catalog, no version information
    * 'boxcutter/ubuntu1504' is outdated! Current: 2.0.9. Latest: 2.0.10
    * 'aribabox' wasn't added from a catalog, no version information
    

    您可以从 Vagrant 源检查,但基本上,如果盒子有元数据信息,它将从 atlas(盒子 repo)检查并从具有此名称的最新盒子中获取元数据并比较 2 个元数据。

    【讨论】:

    • 我知道这是可能的,但是是否可以将其翻译成 bash 中的任何 if 语句?
    猜你喜欢
    • 1970-01-01
    • 2015-12-23
    • 1970-01-01
    • 1970-01-01
    • 2017-03-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-17
    相关资源
    最近更新 更多