lib/kitchen/driver/vagrant.rb in kitchen-vagrant-0.11.1 vs lib/kitchen/driver/vagrant.rb in kitchen-vagrant-0.11.2
- old
+ new
@@ -35,14 +35,15 @@
class Vagrant < Kitchen::Driver::SSHBase
default_config :customize, { :memory => '256' }
default_config :synced_folders, {}
default_config :box do |driver|
- driver.default_values("box")
+ "opscode-#{driver.instance.platform.name}"
end
default_config :box_url do |driver|
- driver.default_values("box_url")
+ "https://opscode-vm-bento.s3.amazonaws.com/vagrant/" \
+ "opscode_#{driver.instance.platform.name}_provisionerless.box"
end
required_config :box
no_parallel_for :create, :destroy
@@ -56,15 +57,11 @@
info("Vagrant instance #{instance.to_str} created.")
end
def converge(state)
create_vagrantfile
- if config[:use_vagrant_provision]
- run "vagrant provision"
- else
- super
- end
+ super
end
def setup(state)
create_vagrantfile
super
@@ -86,48 +83,24 @@
state.delete(:hostname)
end
def verify_dependencies
check_vagrant_version
- check_berkshelf_plugin if config[:use_vagrant_berkshelf_plugin]
end
- def default_values(value)
- (default_boxes[instance.platform.name] || Hash.new)[value]
- end
-
protected
WEBSITE = "http://downloads.vagrantup.com/"
MIN_VER = "1.1.0"
- OMNITRUCK_PREFIX = "https://opscode-vm-bento.s3.amazonaws.com/vagrant"
- PLATFORMS = %w{
- ubuntu-10.04 ubuntu-12.04 ubuntu-12.10 ubuntu-13.04
- centos-6.4 centos-5.9 debian-7.1.0
- }
- def default_boxes
- @default_boxes ||= begin
- hash = Hash.new
- PLATFORMS.each do |platform|
- hash[platform] = Hash.new
- hash[platform]["box"] = "opscode-#{platform}"
- hash[platform]["box_url"] =
- "#{OMNITRUCK_PREFIX}/opscode_#{platform}_provisionerless.box"
- end
- hash
- end
- end
-
def run(cmd, options = {})
cmd = "echo #{cmd}" if config[:dry_run]
run_command(cmd, { :cwd => vagrant_root }.merge(options))
end
def silently_run(cmd)
- run_command(cmd,
- :live_stream => nil, :quiet => logger.debug? ? false : true)
+ run_command(cmd, :live_stream => nil)
end
def vagrant_root
@vagrant_root ||= File.join(
config[:kitchen_root], %w{.kitchen kitchen-vagrant}, instance.name
@@ -177,20 +150,9 @@
def check_vagrant_version
version = vagrant_version
if Gem::Version.new(version) < Gem::Version.new(MIN_VER)
raise UserError, "Detected an old version of Vagrant (#{version})." +
" Please upgrade to version #{MIN_VER} or higher from #{WEBSITE}."
- end
- end
-
- def check_berkshelf_plugin
- if File.exists?(File.join(config[:kitchen_root], "Berksfile"))
- plugins = silently_run("vagrant plugin list").split("\n")
- if ! plugins.find { |p| p =~ /^vagrant-berkshelf\b/ }
- raise UserError, "Detected a Berksfile but the vagrant-berkshelf" +
- " plugin was not found in Vagrant. Please run:" +
- " `vagrant plugin install vagrant-berkshelf' and retry."
- end
end
end
end
end
end