mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Merge pull request #822 from Flowm/ask-before-destroy
Ask for confirmation before destroying vms
This commit is contained in:
@@ -183,11 +183,17 @@ module VagrantPlugins
|
||||
next
|
||||
end
|
||||
|
||||
b2.use ClearForwardedPorts
|
||||
# b2.use PruneNFSExports
|
||||
b2.use DestroyDomain
|
||||
b2.use DestroyNetworks
|
||||
b2.use ProvisionerCleanup
|
||||
b2.use Call, DestroyConfirm do |env2, b3|
|
||||
if env2[:result]
|
||||
b3.use ClearForwardedPorts
|
||||
# b3.use PruneNFSExports
|
||||
b3.use DestroyDomain
|
||||
b3.use DestroyNetworks
|
||||
b3.use ProvisionerCleanup
|
||||
else
|
||||
b3.use MessageWillNotDestroy
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -332,6 +338,7 @@ module VagrantPlugins
|
||||
autoload :MessageNotCreated, action_root.join('message_not_created')
|
||||
autoload :MessageNotRunning, action_root.join('message_not_running')
|
||||
autoload :MessageNotSuspended, action_root.join('message_not_suspended')
|
||||
autoload :MessageWillNotDestroy, action_root.join('message_will_not_destroy')
|
||||
|
||||
autoload :RemoveStaleVolume, action_root.join('remove_stale_volume')
|
||||
|
||||
|
||||
17
lib/vagrant-libvirt/action/message_will_not_destroy.rb
Normal file
17
lib/vagrant-libvirt/action/message_will_not_destroy.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
module VagrantPlugins
|
||||
module ProviderLibvirt
|
||||
module Action
|
||||
class MessageWillNotDestroy
|
||||
def initialize(app, env)
|
||||
@app = app
|
||||
end
|
||||
|
||||
def call(env)
|
||||
env[:ui].info I18n.t("vagrant.commands.destroy.will_not_destroy",
|
||||
name: env[:machine].name)
|
||||
@app.call(env)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user