mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
notification about box removing behaviour
This commit is contained in:
parent
904e4b184f
commit
2008083923
@ -8,6 +8,13 @@ module VagrantPlugins
|
||||
include Vagrant::Action::Builtin
|
||||
@logger = Log4r::Logger.new('vagrant_libvirt::action')
|
||||
|
||||
# remove image from libvirt storage pool
|
||||
def self.remove_libvirt_image
|
||||
Vagrant::Action::Builder.new.tap do |b|
|
||||
b.use RemoveLibvirtImage
|
||||
end
|
||||
end
|
||||
|
||||
# This action is called to bring the box up from nothing.
|
||||
def self.action_up
|
||||
Vagrant::Action::Builder.new.tap do |b|
|
||||
@ -331,6 +338,7 @@ module VagrantPlugins
|
||||
autoload :HaltDomain, action_root.join('halt_domain')
|
||||
autoload :HandleBoxImage, action_root.join('handle_box_image')
|
||||
autoload :HandleStoragePool, action_root.join('handle_storage_pool')
|
||||
autoload :RemoveLibvirtImage, action_root.join('remove_libvirt_image')
|
||||
autoload :IsCreated, action_root.join('is_created')
|
||||
autoload :IsRunning, action_root.join('is_running')
|
||||
autoload :IsSuspended, action_root.join('is_suspended')
|
||||
|
20
lib/vagrant-libvirt/action/remove_libvirt_image.rb
Normal file
20
lib/vagrant-libvirt/action/remove_libvirt_image.rb
Normal file
@ -0,0 +1,20 @@
|
||||
require 'log4r'
|
||||
|
||||
module VagrantPlugins
|
||||
module ProviderLibvirt
|
||||
module Action
|
||||
class RemoveLibvirtImage
|
||||
def initialize(app, env)
|
||||
@logger = Log4r::Logger.new("vagrant_libvirt::action::remove_libvirt_image")
|
||||
@app = app
|
||||
end
|
||||
|
||||
def call(env)
|
||||
env[:ui].info("Vagrant-libvirt plugin removed box only from you LOCAL ~/.vagrant/boxes directory")
|
||||
env[:ui].info("From libvirt storage pool you have to delete image manualy(virsh, virt-manager or by any other tool)")
|
||||
@app.call(env)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -32,6 +32,11 @@ module VagrantPlugins
|
||||
Provider
|
||||
end
|
||||
|
||||
action_hook(:remove_libvirt_image) do |hook|
|
||||
hook.after Vagrant::Action::Builtin::BoxRemove, Action.remove_libvirt_image
|
||||
end
|
||||
|
||||
|
||||
guest_capability('linux', 'mount_p9_shared_folder') do
|
||||
require_relative 'cap/mount_p9'
|
||||
Cap::MountP9
|
||||
@ -88,4 +93,3 @@ module VagrantPlugins
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user