Class: VagrantPlugins::Destroy::Provisioner

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-destroy-provisioner/provisioner.rb

Instance Method Summary collapse

Constructor Details

#initialize(machine, config) ⇒ Provisioner

Returns a new instance of Provisioner.



4
5
6
7
# File 'lib/vagrant-destroy-provisioner/provisioner.rb', line 4

def initialize(machine, config)
  super
  @logger = Log4r::Logger.new("vagrant::provisioners::destroy")
end

Instance Method Details

#provisionObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/vagrant-destroy-provisioner/provisioner.rb', line 9

def provision
  options = {}
  if config.destroy
      options[:force_confirm_destroy] = true
      @logger.info("VM is going to destroy");
      @machine.action(:destroy, options)
  else
      @logger.info("VM is going to halt");
      @machine.action(:halt, options)
  end
  begin
    sleep 2
  end while @machine.communicate.ready?
end