Skip to content

Commit

Permalink
dont alter the path during the bundler cleanup on windows and do not …
Browse files Browse the repository at this point in the history
…map the extra cache drive on non virtualbox windows

Signed-off-by: Matt Wrock <[email protected]>
  • Loading branch information
mwrock committed Dec 1, 2016
1 parent ae31b86 commit 1b88444
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions lib/kitchen/driver/vagrant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ def winrm_transport?
# and share a local folder to that directory so that we don't pull them
# down every single time
def cache_directory
return if windows_host? && config[:provider] != "virtualbox"
config[:cache_directory]
end

Expand Down Expand Up @@ -359,11 +360,22 @@ def run_command(cmd, options = {})
RUBYOPT _ORIGINAL_GEM_PATH].each do |var|
env[var] = nil
end
gem_home = ENV["GEM_HOME"]
if gem_home && (env["PATH"] || ENV["PATH"])
env["PATH"] ||= ENV["PATH"].dup if ENV["PATH"]
gem_bin = File.join(gem_home, "bin") + File::PATH_SEPARATOR
env["PATH"][gem_bin] = "" if env["PATH"].include?(gem_bin)

# Altering the path seems to break vagrant. When the :environment
# is passed to a windows process with a PATH, Vagrant's batch installer
# (https://github.com/mitchellh/vagrant-installers/blob/master/substrate
# /modules/vagrant_installer/templates/windows_vagrant.bat.erb)
# does not efectively prepend the vagrant ruby path in a persistent
# manner which causes vagrant to use the same ruby as test-kitchen and
# then the environment is essentially corrupted leading to many errors
# and dispair
unless windows_host?
gem_home = ENV["GEM_HOME"]
if gem_home && (env["PATH"] || ENV["PATH"])
env["PATH"] ||= ENV["PATH"].dup if ENV["PATH"]
gem_bin = File.join(gem_home, "bin") + File::PATH_SEPARATOR
env["PATH"][gem_bin] = "" if env["PATH"].include?(gem_bin)
end
end

super(cmd, merged)
Expand Down Expand Up @@ -477,6 +489,13 @@ def verify_winrm_plugin
end
end

# @return [true,false] whether or not the host is windows
#
# @api private
def windows_host?
RbConfig::CONFIG["host_os"] =~ /mswin|mingw/
end

# @return [true,false] whether or not the vagrant-winrm plugin is
# installed
# @api private
Expand Down

0 comments on commit 1b88444

Please sign in to comment.