Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix for issue #1036
When doing vagrant up on Windows 7 shell provisioner hangs when uploading a temporary file from local machine to the guest VM. File created in the temporary location on the host is not closed before yielding for upload to guest VM path. This appeared to be the reason for upload process hang as the data was transferred but SCP would still not complete which could be because the end of file character was not sent. I made a change in the shell.rb file under embedded\lib\ruby\gems\1.9.1\gems\vagrant-1.0.3\lib\vagrant\provisioners folder. With this change problem went away and I could deploy the guest VM successfully.
Clarification of the patch:
•Closed file explicitly before upload
--- C:/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/vagrant-1.0.3/lib/vagrant/provisioners/shell.org.rb Tue May 01 23:27:42 2012
+++ C:/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/vagrant-1.0.3/lib/vagrant/provisioners/shell.rb Fri Jul 13 12:08:49 2012
@@ -60,12 +60,13 @@
and handle it specially...
file = Tempfile.new('vagrant-shell')
begin
file.write(config.inline)
file.fsync
•file.close <<<<< Added code to close the file explicitly yield file.path
•ensure
•rescue <<<< Since the file is closed before yielding for upload, now closing and unlinking only for rescue file.close file.unlink end end