Trim drive letter prefix from path

Fixes #9764
This commit is contained in:
Chris Roberts 2018-05-03 09:25:42 -07:00
parent c056a86f1f
commit 8b398b66a3
2 changed files with 15 additions and 4 deletions

View File

@ -101,7 +101,8 @@ module VagrantPlugins
# of a hack but is the most portable way I can think of at the moment
# to achieve this. Otherwise, Vagrant attempts to share at some crazy
# path like /home/vagrant/c:/foo/bar
remote_path = File.expand_path(path.gsub(/^[a-zA-Z]:\//, "/"), guest_provisioning_path.gsub(/^[a-zA-Z]:\//, "/"))
remote_path = File.expand_path(path.sub(/^[a-zA-Z]:\//, "/"), guest_provisioning_path.sub(/^[a-zA-Z]:\//, "/"))
remote_path.sub!(/^[a-zA-Z]:\//, "/")
end
# If we have specified a folder name to append then append it
@ -183,10 +184,10 @@ module VagrantPlugins
)
still_active = 259 #provisioner has asked chef to reboot
@config.attempts.times do |attempt|
exit_status = 0
while exit_status == 0 || exit_status == still_active
while exit_status == 0 || exit_status == still_active
if @machine.guest.capability?(:wait_for_reboot)
@machine.guest.capability(:wait_for_reboot)
elsif attempt > 0

View File

@ -23,12 +23,22 @@ describe VagrantPlugins::Chef::Provisioner::ChefSolo do
end
describe "#expanded_folders" do
before { allow(subject).to receive(:windows?).and_return(true) }
it "handles the default Windows provisioning path" do
allow(config).to receive(:provisioning_path).and_return(nil)
allow(subject).to receive(:windows?).and_return(true)
remote_path = subject.expanded_folders([[:vm, "cookbooks-1"]])[0][2]
expect(remote_path).to eq("/vagrant-chef/cookbooks-1")
end
it "removes drive letter prefix from path" do
allow(config).to receive(:provisioning_path).and_return(nil)
expect(File).to receive(:expand_path).and_return("C:/vagrant-chef/cookbooks-1")
result = subject.expanded_folders([[:vm, "cookbooks-1"]])
remote_path = result[0][2]
expect(remote_path).to eq("/vagrant-chef/cookbooks-1")
end
end
describe "#expanded_folders" do