2015-12-07 192 views
0

我的团队正在使用流浪汉,无论何时出现新框,我们都会更新以保持最新状态。我们不关心盒子的新版本是一个问题。是否可以通过脚本检查Vagrant框是否过期?

所以我期待创建一个脚本(在Windows和Mac,是它可能会不同的格式,但这个想法是一样的),将检查更新,并如果它们存在应用它们。

我的意思是我想要的东西,我的团队为vagrant_launch.sh运行,从而将做

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

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

回答

1

您可以在一个特定的Vagrantfile运行vagrant box outdated检查,如果这个特殊的是过时的或没有。

您还可以运行vagrant box outdated --global检查所有已安装的箱子,例如

[email protected]:~$ 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 

您可以从流浪源检查,但基本上,如果框有元数据信息,它将从地图集检查(盒回购),并从最新的盒子中获取元数据并比较2个元数据。

+0

我知道这是可能的,但是有可能将它翻译成bash中的任何一种if语句,例如? –

+0

你应该可以运行命令并读取结果 –

相关问题