Class: Kitchen::Driver::Vagrant

Inherits:
SSHBase
  • Object
show all
Defined in:
lib/kitchen/driver/vagrant.rb

Overview

TODO:

Vagrant installation check and version will be placed into any dependency hook checks when feature is released

Vagrant driver for Kitchen. It communicates to Vagrant via the CLI.

Author:

Instance Method Summary collapse

Instance Method Details

#converge(state) ⇒ Object



60
61
62
63
# File 'lib/kitchen/driver/vagrant.rb', line 60

def converge(state)
  create_vagrantfile
  super
end

#create(state) ⇒ Object



51
52
53
54
55
56
57
58
# File 'lib/kitchen/driver/vagrant.rb', line 51

def create(state)
  create_vagrantfile
  cmd = "vagrant up --no-provision"
  cmd += " --provider=#{@config[:provider]}" if @config[:provider]
  run cmd
  set_ssh_state(state)
  info("Vagrant instance #{instance.to_str} created.")
end

#destroy(state) ⇒ Object



75
76
77
78
79
80
81
82
83
84
# File 'lib/kitchen/driver/vagrant.rb', line 75

def destroy(state)
  return if state[:hostname].nil?

  create_vagrantfile
  @vagrantfile_created = false
  run "vagrant destroy -f"
  FileUtils.rm_rf(vagrant_root)
  info("Vagrant instance #{instance.to_str} destroyed.")
  state.delete(:hostname)
end

#setup(state) ⇒ Object



65
66
67
68
# File 'lib/kitchen/driver/vagrant.rb', line 65

def setup(state)
  create_vagrantfile
  super
end

#verify(state) ⇒ Object



70
71
72
73
# File 'lib/kitchen/driver/vagrant.rb', line 70

def verify(state)
  create_vagrantfile
  super
end

#verify_dependenciesObject



86
87
88
# File 'lib/kitchen/driver/vagrant.rb', line 86

def verify_dependencies
  check_vagrant_version
end