lib/kitchen/driver/vagrant.rb in kitchen-vagrant-1.1.1 vs lib/kitchen/driver/vagrant.rb in kitchen-vagrant-1.2.0
- old
+ new
@@ -93,11 +93,11 @@
default_config :kitchen_cache_directory,
File.expand_path("~/.kitchen/cache")
default_config :cachier, nil
- no_parallel_for :create, :destroy
+ # no_parallel_for :create, :destroy
# Creates a Vagrant VM instance.
#
# @param state [Hash] mutable instance state
# @raise [ActionFailed] if the action could not be completed
@@ -376,10 +376,18 @@
# @param cmd [String] command to run locally
# @param options [Hash] options hash
# @see Kitchen::ShellOut.run_command
# @api private
def run(cmd, options = {})
+ if vagrant_root && config[:provider] == "virtualbox"
+ require "digest"
+ options[:environment] = {} if options[:environment].nil?
+ options[:environment]["VBOX_IPC_SOCKETID"] =
+ Digest::SHA256.hexdigest(vagrant_root)
+ options[:environment]["VBOX_USER_HOME"] = vagrant_root
+ debug("Accessing isolated VirtualBox environment in #{vagrant_root}")
+ end
cmd = "echo #{cmd}" if config[:dry_run]
run_command(cmd, { :cwd => vagrant_root }.merge(options))
end
# Delegates to Kitchen::ShellOut.run_command, overriding some default
@@ -438,9 +446,14 @@
# Runs a local command before `vagrant up` has been called.
#
# @api private
def run_pre_create_command
+ if vagrant_root && config[:provider] == "virtualbox"
+ run("vboxmanage setproperty machinefolder #{vagrant_root}",
+ :cwd => config[:kitchen_root])
+ debug("Set VirtualBox machinefolder to #{vagrant_root}")
+ end
if config[:pre_create_command]
run(config[:pre_create_command], :cwd => config[:kitchen_root])
end
end