lib/kitchen/driver/vagrant.rb in kitchen-vagrant-0.19.0 vs lib/kitchen/driver/vagrant.rb in kitchen-vagrant-0.20.0
- old
+ new
@@ -41,18 +41,24 @@
default_config(:box) { |driver| driver.default_box }
required_config :box
default_config :box_check_update, nil
+ default_config :box_download_insecure, nil
+
default_config(:box_url) { |driver| driver.default_box_url }
default_config :box_version, nil
+ default_config :boot_timeout, nil
+
default_config :customize, {}
default_config :gui, nil
+ default_config :linked_clone, nil
+
default_config :network, []
default_config :pre_create_command, nil
default_config :provision, false
@@ -63,10 +69,12 @@
default_config :ssh, {}
default_config :synced_folders, []
+ default_config :vagrant_binary, "vagrant"
+
default_config :vagrantfile_erb,
File.join(File.dirname(__FILE__), "../../../templates/Vagrantfile.erb")
expand_path_for :vagrantfile_erb
default_config :vagrantfiles, []
@@ -92,27 +100,19 @@
end
# @return [String,nil] the Vagrant box for this Instance
def default_box
if bento_box?(instance.platform.name)
- "opscode-#{instance.platform.name}"
+ "bento/#{instance.platform.name}"
else
instance.platform.name
end
end
# @return [String,nil] the Vagrant box URL for this Instance
def default_box_url
- return unless bento_box?(instance.platform.name)
-
- provider = config[:provider]
- provider = "vmware" if config[:provider] =~ /^vmware_(.+)$/
-
- if %w[virtualbox vmware].include?(provider)
- "https://opscode-vm-bento.s3.amazonaws.com/vagrant/#{provider}/" \
- "opscode_#{instance.platform.name}_chef-provisionerless.box"
- end
+ nil
end
# Destroys an instance.
#
# @param state [Hash] mutable instance state
@@ -121,11 +121,11 @@
return if state[:hostname].nil?
create_vagrantfile
@vagrantfile_created = false
instance.transport.connection(state).close
- run("vagrant destroy -f")
+ run("#{config[:vagrant_binary]} destroy -f")
FileUtils.rm_rf(vagrant_root)
info("Vagrant instance #{instance.to_str} destroyed.")
state.delete(:hostname)
end
@@ -365,11 +365,11 @@
# Runs the `vagrant up` command locally.
#
# @api private
def run_vagrant_up
- cmd = "vagrant up"
+ cmd = "#{config[:vagrant_binary]} up"
cmd += " --no-provision" unless config[:provision]
cmd += " --provider #{config[:provider]}" if config[:provider]
run(cmd)
end
@@ -403,11 +403,12 @@
# @return [Hash] key/value pairs resulting from parsing a
# `vagrant ssh-config` or `vagrant winrm-config` local command
# invocation
# @api private
def vagrant_config(type)
- lines = run_silently("vagrant #{type}-config").split("\n").map do |line|
+ lines = run_silently("#{config[:vagrant_binary]} #{type}-config").
+ split("\n").map do |line|
tokens = line.strip.partition(" ")
[tokens.first, tokens.last.gsub(/"/, "")]
end
Hash[lines]
end
@@ -415,11 +416,12 @@
# @return [String] version of Vagrant
# @raise [UserError] if the `vagrant` command can not be found locally
# @api private
def vagrant_version
self.class.vagrant_version ||= run_silently(
- "vagrant --version", :cwd => Dir.pwd).chomp.split(" ").last
+ "#{config[:vagrant_binary]} --version", :cwd => Dir.pwd).
+ chomp.split(" ").last
rescue Errno::ENOENT
raise UserError, "Vagrant #{MIN_VER} or higher is not installed." \
" Please download a package from #{WEBSITE}."
end
@@ -448,10 +450,10 @@
# @api private
def winrm_plugin_installed?
return true if self.class.winrm_plugin_passed
self.class.winrm_plugin_passed = run_silently(
- "vagrant plugin list", :cwd => Dir.pwd).
+ "#{config[:vagrant_binary]} plugin list", :cwd => Dir.pwd).
split("\n").find { |line| line =~ /^vagrant-winrm\s+/ }
end
end
end
end