Add the --provider optional flag to `box add`
This commit is contained in:
parent
2d8a048946
commit
124a2ee5d3
|
@ -27,7 +27,7 @@ module Vagrant
|
||||||
# Add the box
|
# Add the box
|
||||||
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
|
begin
|
||||||
env[:box_collection].add(@temp_path, env[:box_name])
|
env[:box_collection].add(@temp_path, env[:box_name], env[:box_provider])
|
||||||
rescue Vagrant::Errors::BoxUpgradeRequired
|
rescue Vagrant::Errors::BoxUpgradeRequired
|
||||||
# Upgrade the box
|
# Upgrade the box
|
||||||
env[:box_collection].upgrade(env[:box_name])
|
env[:box_collection].upgrade(env[:box_name])
|
||||||
|
|
|
@ -8,12 +8,17 @@ module VagrantPlugins
|
||||||
options = {}
|
options = {}
|
||||||
|
|
||||||
opts = OptionParser.new do |o|
|
opts = OptionParser.new do |o|
|
||||||
o.banner = "Usage: vagrant box add <name> <url>"
|
o.banner = "Usage: vagrant box add <name> <url> [--provider provider] [-h]"
|
||||||
o.separator ""
|
o.separator ""
|
||||||
|
|
||||||
o.on("-f", "--force", "Overwrite an existing box if it exists.") do |f|
|
o.on("-f", "--force", "Overwrite an existing box if it exists.") do |f|
|
||||||
options[:force] = f
|
options[:force] = f
|
||||||
end
|
end
|
||||||
|
|
||||||
|
o.on("--provider provider", String,
|
||||||
|
"The provider that backs the box.") do |p|
|
||||||
|
options[:provider] = p
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Parse the options
|
# Parse the options
|
||||||
|
@ -30,7 +35,7 @@ module VagrantPlugins
|
||||||
|
|
||||||
@env.action_runner.run(Vagrant::Action.action_box_add, {
|
@env.action_runner.run(Vagrant::Action.action_box_add, {
|
||||||
:box_name => argv[0],
|
:box_name => argv[0],
|
||||||
:box_provider => :virtualbox,
|
:box_provider => options[:provider].to_sym,
|
||||||
:box_url => argv[1]
|
:box_url => argv[1]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue