Class: Vagrant::Butcher::Action::Cleanup

Inherits:
Object
  • Object
show all
Includes:
Helpers::Action, Helpers::Connection
Defined in:
lib/vagrant-butcher/action/cleanup.rb

Instance Method Summary collapse

Methods included from Helpers::Connection

#cleanup, #delete_resource, #setup_connection

Methods included from Helpers::KeyFiles

#cache_dir, #cleanup_cache_dir, #client_key_path, #copy_guest_key, #create_cache_dir, #grab_key_from_guest, #guest_key_path, #key_filename

Methods included from Helpers::Action

#machine, #root_path, #ui

Methods included from Helpers::Config

#butcher_config, #chef_client?, #chef_provisioner, #client_name, #victim, #vm_config

Constructor Details

#initialize(app, env) ⇒ Cleanup

Returns a new instance of Cleanup.



8
9
10
# File 'lib/vagrant-butcher/action/cleanup.rb', line 8

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

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/vagrant-butcher/action/cleanup.rb', line 12

def call(env)
  if butcher_config(machine(env)).enabled
    cleanup(env)
  else
    ui(env).warn "Vagrant::Butcher disabled, not cleaning up Chef server!"
  end

  @app.call(env)
end