Class: Kitchen::Driver::Localhost

Inherits:
Base
  • Object
show all
Includes:
Localhost::ShellOut
Defined in:
lib/kitchen/driver/localhost.rb

Overview

Localhost driver for Kitchen.

Author:

Instance Method Summary collapse

Methods included from Localhost::ShellOut

#cp_r, #mkdir_p, #rm_rf, #run_command, #run_command_psh, #run_command_sh, #windows_os?

Instance Method Details

#create(state) ⇒ Object

Create the temp dirs on the local filesystem for Kitchen.

(see Base#create)


44
45
46
47
# File 'lib/kitchen/driver/localhost.rb', line 44

def create(state)
  state[:hostname] = Socket.gethostname
  logger.info("[Localhost] Instance #{instance} ready.")
end

#destroy(_) ⇒ Object

Clean up the temp dirs left behind

(see Base#destroy)


54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/kitchen/driver/localhost.rb', line 54

def destroy(_)
  if config[:clean_up_on_destroy]
    [
      instance.provisioner[:root_path], instance.verifier[:root_path]
    ].each do |p|
      rm_rf(p)
      logger.info("[Localhost] Deleted temp dir '#{p}'.")
    end
  else
    logger.info('[Localhost] Leaving Kitchen temp dirs in place.')
  end
end