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



73
74
75
76
# File 'lib/kitchen/driver/vagrant.rb', line 73

def converge(state)
  create_vagrantfile
  super
end

#create(state) ⇒ Object



63
64
65
66
67
68
69
70
71
# File 'lib/kitchen/driver/vagrant.rb', line 63

def create(state)
  create_vagrantfile
  run_pre_create_command
  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

#default_box_urlObject



108
109
110
111
112
113
114
# File 'lib/kitchen/driver/vagrant.rb', line 108

def default_box_url
  bucket = config[:provider]
  bucket = 'vmware' if config[:provider] =~ /^vmware_(.+)$/

  "https://opscode-vm-bento.s3.amazonaws.com/vagrant/#{bucket}/" +
    "opscode_#{instance.platform.name}_chef-provisionerless.box"
end

#destroy(state) ⇒ Object



88
89
90
91
92
93
94
95
96
97
# File 'lib/kitchen/driver/vagrant.rb', line 88

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

#instance=(instance) ⇒ Object



103
104
105
106
# File 'lib/kitchen/driver/vagrant.rb', line 103

def instance=(instance)
  @instance = instance
  resolve_config!
end

#setup(state) ⇒ Object



78
79
80
81
# File 'lib/kitchen/driver/vagrant.rb', line 78

def setup(state)
  create_vagrantfile
  super
end

#verify(state) ⇒ Object



83
84
85
86
# File 'lib/kitchen/driver/vagrant.rb', line 83

def verify(state)
  create_vagrantfile
  super
end

#verify_dependenciesObject



99
100
101
# File 'lib/kitchen/driver/vagrant.rb', line 99

def verify_dependencies
  check_vagrant_version
end