Uploaded files now use temporary files rather than StringIO

This commit is contained in:
Mitchell Hashimoto 2012-01-06 21:42:25 -08:00
parent 275ddae646
commit 7d56dbb755
6 changed files with 30 additions and 7 deletions

View File

@ -5,6 +5,7 @@ Vagrant::Config.run do |config|
config.vagrant.ssh_session_cache = false
config.ssh.username = "vagrant"
config.ssh.password = "vagrant"
config.ssh.host = "127.0.0.1"
config.ssh.guest_port = 22
config.ssh.max_tries = 100

View File

@ -153,7 +153,6 @@ module Vagrant
ch2.on_request("exit-status") do |ch3, data|
exit_status = data.read_long
yield :exit_status, exit_status if block_given?
end
# Set the terminal

View File

@ -2,6 +2,7 @@ module Vagrant
module Config
class SSHConfig < Base
attr_accessor :username
attr_accessor :password
attr_accessor :host
attr_accessor :port
attr_accessor :guest_port

View File

@ -1,4 +1,5 @@
require 'set'
require 'tempfile'
require 'vagrant/util/template_renderer'
@ -27,7 +28,11 @@ module Vagrant
# Perform the careful dance necessary to reconfigure
# the network interfaces
vm.channel.upload(StringIO.new(entries.join("\n")), "/tmp/vagrant-network-entry")
temp = Tempfile.new("vagrant")
temp.write(entries.join("\n"))
temp.close
vm.channel.upload(temp.path, "/tmp/vagrant-network-entry")
# Bring down all the interfaces we're reconfiguring. By bringing down
# each specifically, we avoid reconfiguring eth0 (the NAT interface) so

View File

@ -26,7 +26,12 @@ module Vagrant
# temporary location.
entry = TemplateRenderer.render("guests/redhat/network_#{network[:type]}",
:options => network)
vm.channel.upload(StringIO.new(entry), "/tmp/vagrant-network-entry_#{network[:interface]}")
temp = Tempfile.new("vagrant")
temp.write(entry)
temp.close
vm.channel.upload(temp.path, "/tmp/vagrant-network-entry_#{network[:interface]}")
end
# Bring down all the interfaces we're reconfiguring. By bringing down

View File

@ -1,3 +1,5 @@
require 'tempfile'
module Vagrant
module Provisioners
# This class is a base class where the common functionality shared between
@ -49,8 +51,13 @@ module Vagrant
:no_proxy => config.no_proxy
}.merge(template_vars))
env[:vm].channel.upload(StringIO.new(config_file),
File.join(config.provisioning_path, filename))
# Create a temporary file to store the data so we
# can upload it
temp = Tempfile.new("vagrant")
temp.write(config_file)
temp.close
env[:vm].channel.upload(temp.path, File.join(config.provisioning_path, filename))
end
def setup_json
@ -72,8 +79,13 @@ module Vagrant
json = data.to_json
env[:vm].channel.upload(StringIO.new(json),
File.join(config.provisioning_path, "dna.json"))
# Create a temporary file to store the data so we
# can upload it
temp = Tempfile.new("vagrant")
temp.write(json)
temp.close
env[:vm].channel.upload(temp.path, File.join(config.provisioning_path, "dna.json"))
end
end