vagrant box remove doesn't need provider if box only has one [GH-1032]
This commit is contained in:
parent
f38b6801f9
commit
3840e07adb
|
@ -8,6 +8,8 @@ FEATURES:
|
||||||
|
|
||||||
IMPROVEMENTS:
|
IMPROVEMENTS:
|
||||||
|
|
||||||
|
- `vagrant box remove` works with only the name of the box if that
|
||||||
|
box exists only backed by one provider. [GH-1032]
|
||||||
- `vagrant destroy` returns exit status 1 if any of the confirmations
|
- `vagrant destroy` returns exit status 1 if any of the confirmations
|
||||||
are declined. [GH-923]
|
are declined. [GH-923]
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,27 @@ module VagrantPlugins
|
||||||
# Parse the options
|
# Parse the options
|
||||||
argv = parse_options(opts)
|
argv = parse_options(opts)
|
||||||
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 < 1
|
||||||
|
|
||||||
|
if !argv[1]
|
||||||
|
# Try to automatically determine the provider.
|
||||||
|
providers = []
|
||||||
|
@env.boxes.all.each do |name, provider|
|
||||||
|
if name == argv[0]
|
||||||
|
providers << provider
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if providers.length > 1
|
||||||
|
@env.ui.error(
|
||||||
|
I18n.t("vagrant.commands.box.remove_must_specify_provider",
|
||||||
|
name: args[0],
|
||||||
|
providers: providers.join(", ")))
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
argv[1] = providers[0] || ""
|
||||||
|
end
|
||||||
|
|
||||||
b = nil
|
b = nil
|
||||||
begin
|
begin
|
||||||
|
|
|
@ -656,6 +656,17 @@ en:
|
||||||
vm_not_created: "VM not created. Moving on..."
|
vm_not_created: "VM not created. Moving on..."
|
||||||
vm_not_running: "VM is not currently running. Please bring it up to run this command."
|
vm_not_running: "VM is not currently running. Please bring it up to run this command."
|
||||||
box:
|
box:
|
||||||
|
remove_must_specify_provider: |-
|
||||||
|
Multiple providers were found for the box '%{name}'. Please specify
|
||||||
|
the specific provider for the box you want to remove. The list of
|
||||||
|
providers backing this box is:
|
||||||
|
|
||||||
|
'%{providers}'
|
||||||
|
|
||||||
|
To remove the box for a specific provider, run the following command,
|
||||||
|
filling in PROVIDER with one of the providers above:
|
||||||
|
|
||||||
|
vagrant box remove '%{name}' PROVIDER
|
||||||
no_installed_boxes: "There are no installed boxes! Use `vagrant box add` to add some."
|
no_installed_boxes: "There are no installed boxes! Use `vagrant box add` to add some."
|
||||||
removing: |-
|
removing: |-
|
||||||
Removing box '%{name}' with provider '%{provider}'...
|
Removing box '%{name}' with provider '%{provider}'...
|
||||||
|
|
Loading…
Reference in New Issue