Automatically upgrade the boxes all over.
This commit is contained in:
parent
bcd1304ef4
commit
f20666e230
|
@ -12,7 +12,17 @@ module Vagrant
|
||||||
|
|
||||||
def call(env)
|
def call(env)
|
||||||
@env[:ui].info I18n.t("vagrant.actions.box.add.adding", :name => env[:box_name])
|
@env[:ui].info I18n.t("vagrant.actions.box.add.adding", :name => env[:box_name])
|
||||||
|
|
||||||
|
begin
|
||||||
env[:box_collection].add(env[:box_download_temp_path], env[:box_name])
|
env[:box_collection].add(env[:box_download_temp_path], env[:box_name])
|
||||||
|
rescue Vagrant::Errors::BoxUpgradeRequired
|
||||||
|
# Upgrade the box
|
||||||
|
env[:box_collection].upgrade(env[:box_name])
|
||||||
|
|
||||||
|
# Try adding it again
|
||||||
|
retry
|
||||||
|
end
|
||||||
|
|
||||||
@app.call(env)
|
@app.call(env)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,7 +16,14 @@ module VagrantPlugins
|
||||||
return if !argv
|
return if !argv
|
||||||
raise Vagrant::Errors::CLIInvalidUsage, :help => opts.help.chomp if argv.length < 2
|
raise Vagrant::Errors::CLIInvalidUsage, :help => opts.help.chomp if argv.length < 2
|
||||||
|
|
||||||
|
b = nil
|
||||||
|
begin
|
||||||
b = @env.boxes.find(argv[0], argv[1].to_sym)
|
b = @env.boxes.find(argv[0], argv[1].to_sym)
|
||||||
|
rescue Vagrant::Errors::BoxUpgradeRequired
|
||||||
|
@env.boxes.upgrade(argv[0])
|
||||||
|
retry
|
||||||
|
end
|
||||||
|
|
||||||
raise Vagrant::Errors::BoxNotFound, :name => argv[0] if !b
|
raise Vagrant::Errors::BoxNotFound, :name => argv[0] if !b
|
||||||
b.destroy!
|
b.destroy!
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,15 @@ module VagrantPlugins
|
||||||
box_provider = argv[1].to_sym
|
box_provider = argv[1].to_sym
|
||||||
|
|
||||||
# Verify the box exists that we want to repackage
|
# Verify the box exists that we want to repackage
|
||||||
|
box = nil
|
||||||
|
begin
|
||||||
box = @env.boxes.find(box_name, box_provider)
|
box = @env.boxes.find(box_name, box_provider)
|
||||||
raise Vagrant::Errors::BoxNotFound, :name => box_name if !b
|
rescue Vagrant::Errors::BoxUpgradeRequired
|
||||||
|
@env.boxes.upgrade(box_name)
|
||||||
|
retry
|
||||||
|
end
|
||||||
|
|
||||||
|
raise Vagrant::Errors::BoxNotFound, :name => box_name if !box
|
||||||
|
|
||||||
# Repackage the box
|
# Repackage the box
|
||||||
output_path = File.expand_path(@env.config.global.package.name, FileUtils.pwd)
|
output_path = File.expand_path(@env.config.global.package.name, FileUtils.pwd)
|
||||||
|
|
Loading…
Reference in New Issue