Show nice error if vagrant destroy can't confirm [GH-779]
This commit is contained in:
parent
95b3e9f82f
commit
3046845215
|
@ -2,6 +2,8 @@
|
|||
|
||||
- Add missing `rubygems` require in `environment.rb` to avoid
|
||||
possible load errors. [GH-781]
|
||||
- `vagrant destroy` shows a nice error when called without a
|
||||
TTY (and hence can't confirm). [GH-779]
|
||||
|
||||
## 1.0.0 (March 6, 2012)
|
||||
|
||||
|
|
|
@ -30,8 +30,15 @@ module Vagrant
|
|||
if options[:force]
|
||||
do_destroy = true
|
||||
else
|
||||
choice = @env.ui.ask(I18n.t("vagrant.commands.destroy.confirmation",
|
||||
:name => vm.name))
|
||||
choice = nil
|
||||
begin
|
||||
choice = @env.ui.ask(I18n.t("vagrant.commands.destroy.confirmation",
|
||||
:name => vm.name))
|
||||
rescue Errors::UIExpectsTTY
|
||||
# We raise a more specific error but one which basically
|
||||
# means the same thing.
|
||||
raise Errors::DestroyRequiresForce
|
||||
end
|
||||
do_destroy = choice.upcase == "Y"
|
||||
end
|
||||
|
||||
|
|
|
@ -148,6 +148,11 @@ module Vagrant
|
|||
error_key(:deprecation)
|
||||
end
|
||||
|
||||
class DestroyRequiresForce < VagrantError
|
||||
status_code(74)
|
||||
error_key(:destroy_requires_force)
|
||||
end
|
||||
|
||||
class DotfileIsDirectory < VagrantError
|
||||
status_code(46)
|
||||
error_key(:dotfile_is_directory)
|
||||
|
|
|
@ -36,6 +36,10 @@ en:
|
|||
|
||||
%{message}
|
||||
Note that this error message will not appear in the next version of Vagrant.
|
||||
destroy_requires_force: |-
|
||||
Destroy doesn't have a TTY to ask for confirmation. Please pass the
|
||||
`--force` flag to force a destroy, otherwise attach a TTY so that
|
||||
the destroy can be confirmed.
|
||||
dotfile_is_directory: |-
|
||||
The local file Vagrant uses to store data ".vagrant" already exists
|
||||
and is a directory! If you are in your home directory, then please run
|
||||
|
|
Loading…
Reference in New Issue