Uploaded files now use temporary files rather than StringIO
This commit is contained in:
parent
275ddae646
commit
7d56dbb755
|
@ -5,6 +5,7 @@ Vagrant::Config.run do |config|
|
||||||
config.vagrant.ssh_session_cache = false
|
config.vagrant.ssh_session_cache = false
|
||||||
|
|
||||||
config.ssh.username = "vagrant"
|
config.ssh.username = "vagrant"
|
||||||
|
config.ssh.password = "vagrant"
|
||||||
config.ssh.host = "127.0.0.1"
|
config.ssh.host = "127.0.0.1"
|
||||||
config.ssh.guest_port = 22
|
config.ssh.guest_port = 22
|
||||||
config.ssh.max_tries = 100
|
config.ssh.max_tries = 100
|
||||||
|
|
|
@ -153,7 +153,6 @@ module Vagrant
|
||||||
|
|
||||||
ch2.on_request("exit-status") do |ch3, data|
|
ch2.on_request("exit-status") do |ch3, data|
|
||||||
exit_status = data.read_long
|
exit_status = data.read_long
|
||||||
yield :exit_status, exit_status if block_given?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Set the terminal
|
# Set the terminal
|
||||||
|
|
|
@ -2,6 +2,7 @@ module Vagrant
|
||||||
module Config
|
module Config
|
||||||
class SSHConfig < Base
|
class SSHConfig < Base
|
||||||
attr_accessor :username
|
attr_accessor :username
|
||||||
|
attr_accessor :password
|
||||||
attr_accessor :host
|
attr_accessor :host
|
||||||
attr_accessor :port
|
attr_accessor :port
|
||||||
attr_accessor :guest_port
|
attr_accessor :guest_port
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
require 'set'
|
require 'set'
|
||||||
|
require 'tempfile'
|
||||||
|
|
||||||
require 'vagrant/util/template_renderer'
|
require 'vagrant/util/template_renderer'
|
||||||
|
|
||||||
|
@ -27,7 +28,11 @@ module Vagrant
|
||||||
|
|
||||||
# Perform the careful dance necessary to reconfigure
|
# Perform the careful dance necessary to reconfigure
|
||||||
# the network interfaces
|
# 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
|
# Bring down all the interfaces we're reconfiguring. By bringing down
|
||||||
# each specifically, we avoid reconfiguring eth0 (the NAT interface) so
|
# each specifically, we avoid reconfiguring eth0 (the NAT interface) so
|
||||||
|
|
|
@ -26,7 +26,12 @@ module Vagrant
|
||||||
# temporary location.
|
# temporary location.
|
||||||
entry = TemplateRenderer.render("guests/redhat/network_#{network[:type]}",
|
entry = TemplateRenderer.render("guests/redhat/network_#{network[:type]}",
|
||||||
:options => network)
|
: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
|
end
|
||||||
|
|
||||||
# Bring down all the interfaces we're reconfiguring. By bringing down
|
# Bring down all the interfaces we're reconfiguring. By bringing down
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
require 'tempfile'
|
||||||
|
|
||||||
module Vagrant
|
module Vagrant
|
||||||
module Provisioners
|
module Provisioners
|
||||||
# This class is a base class where the common functionality shared between
|
# This class is a base class where the common functionality shared between
|
||||||
|
@ -49,8 +51,13 @@ module Vagrant
|
||||||
:no_proxy => config.no_proxy
|
:no_proxy => config.no_proxy
|
||||||
}.merge(template_vars))
|
}.merge(template_vars))
|
||||||
|
|
||||||
env[:vm].channel.upload(StringIO.new(config_file),
|
# Create a temporary file to store the data so we
|
||||||
File.join(config.provisioning_path, filename))
|
# 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
|
end
|
||||||
|
|
||||||
def setup_json
|
def setup_json
|
||||||
|
@ -72,8 +79,13 @@ module Vagrant
|
||||||
|
|
||||||
json = data.to_json
|
json = data.to_json
|
||||||
|
|
||||||
env[:vm].channel.upload(StringIO.new(json),
|
# Create a temporary file to store the data so we
|
||||||
File.join(config.provisioning_path, "dna.json"))
|
# 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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue