Class: VagrantZFS::Action::Box::Destroy

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant_zfs/action/box/destroy.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ Destroy

Returns a new instance of Destroy.



5
6
7
8
# File 'lib/vagrant_zfs/action/box/destroy.rb', line 5

def initialize(app, env)
  @app = app
  @env = env
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/vagrant_zfs/action/box/destroy.rb', line 10

def call(env)
  # Delete the existing box
  env[:ui].info I18n.t("vagrant.actions.box.destroy.destroying", :name => env[:box_name])
  VagrantZFS::ZFS.destroy_at env['box_directory'].to_s

  # Reload the box collection
  env[:box_collection].reload!

  @app.call(env)
end