--provider on box add supports any format of that provider
This commit is contained in:
parent
4b299c9fc2
commit
a786bb53d0
|
@ -18,6 +18,8 @@ IMPROVEMENTS:
|
||||||
- Vagrant will show an error if VirtualBox 4.2.14 is running.
|
- Vagrant will show an error if VirtualBox 4.2.14 is running.
|
||||||
- Added provider to BoxNotFound error message. [GH-1692]
|
- Added provider to BoxNotFound error message. [GH-1692]
|
||||||
- If Ansible fails to run properly, show an error message. [GH-1699]
|
- If Ansible fails to run properly, show an error message. [GH-1699]
|
||||||
|
- Adding a box with the `--provider` flag will now allow a box for
|
||||||
|
any of that provider's supported formats.
|
||||||
|
|
||||||
BUG FIXES:
|
BUG FIXES:
|
||||||
|
|
||||||
|
|
|
@ -44,12 +44,23 @@ module Vagrant
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
box_formats = env[:box_provider]
|
||||||
|
if box_formats
|
||||||
|
# Determine the formats a box can support and allow the box to
|
||||||
|
# be any of those formats.
|
||||||
|
provider_plugin = Vagrant.plugin("2").manager.providers[env[:box_provider]]
|
||||||
|
if provider_plugin
|
||||||
|
box_formats = provider_plugin[1][:box_format]
|
||||||
|
box_formats ||= env[:box_provider]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# 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])
|
||||||
added_box = nil
|
added_box = nil
|
||||||
begin
|
begin
|
||||||
added_box = env[:box_collection].add(
|
added_box = env[:box_collection].add(
|
||||||
@temp_path, env[:box_name], env[:box_provider], env[:box_force])
|
@temp_path, env[:box_name], box_formats, env[:box_force])
|
||||||
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])
|
||||||
|
|
Loading…
Reference in New Issue