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

Shell provisioner hangs on Windows 7 #1036

Closed
mandarbarve opened this issue Jul 20, 2012 · 3 comments
Closed

Shell provisioner hangs on Windows 7 #1036

mandarbarve opened this issue Jul 20, 2012 · 3 comments

Comments

@mandarbarve
Copy link

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.

Below is the patch for the change made. Please take a look.

--- 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
       yield file.path
    
  •    ensure
    
  •  rescue
       file.close
       file.unlink
     end
    
    end
@mandarbarve
Copy link
Author

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

@obscurerichard
Copy link
Contributor

The patches in pull request 1182 and 1183 should have resolved this too.

@mitchellh
Copy link
Contributor

Good to hear, closing!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants