Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallel virtualbox #202

Merged
merged 2 commits into from
Jul 28, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion lib/kitchen/driver/vagrant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class Vagrant < Kitchen::Driver::Base

default_config :cachier, nil

no_parallel_for :create, :destroy
# no_parallel_for :create, :destroy

# Creates a Vagrant VM instance.
#
Expand Down Expand Up @@ -355,6 +355,14 @@ def render_template
# @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
Expand Down Expand Up @@ -417,6 +425,11 @@ def run_command(cmd, options = {})
#
# @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
Expand Down