Use `binmode` to actually fix GH-727

This commit is contained in:
Mitchell Hashimoto 2012-02-11 10:36:27 -08:00
parent 9e427562ef
commit b64ac0b0d3
5 changed files with 5 additions and 19 deletions

View File

@ -1,7 +1,6 @@
require 'set'
require 'tempfile'
require 'vagrant/util/line_ending_helpers'
require 'vagrant/util/template_renderer'
module Vagrant
@ -9,7 +8,6 @@ module Vagrant
class Arch < Linux
# Make the TemplateRenderer top-level
include Vagrant::Util
include Vagrant::Util::LineEndingHelpers
def change_host_name(name)
# Only do this if the hostname is not already set
@ -33,14 +31,13 @@ module Vagrant
entry = TemplateRenderer.render("guests/arch/network_#{network[:type]}",
:options => network)
# Convert to proper line endings
entry = dos_to_unix(entry)
entries << entry
end
# Perform the careful dance necessary to reconfigure
# the network interfaces
temp = Tempfile.new("vagrant")
temp.binmode
temp.write(entries.join("\n"))
temp.close

View File

@ -1,7 +1,6 @@
require 'set'
require 'tempfile'
require 'vagrant/util/line_ending_helpers'
require 'vagrant/util/template_renderer'
module Vagrant
@ -9,7 +8,6 @@ module Vagrant
class Debian < Linux
# Make the TemplateRenderer top-level
include Vagrant::Util
include Vagrant::Util::LineEndingHelpers
def configure_networks(networks)
# First, remove any previous network modifications
@ -27,14 +25,13 @@ module Vagrant
entry = TemplateRenderer.render("guests/debian/network_#{network[:type]}",
:options => network)
# Convert line endings properly and save
entry = dos_to_unix(entry)
entries << entry
end
# Perform the careful dance necessary to reconfigure
# the network interfaces
temp = Tempfile.new("vagrant")
temp.binmode
temp.write(entries.join("\n"))
temp.close

View File

@ -1,6 +1,5 @@
require 'tempfile'
require 'vagrant/util/line_ending_helpers'
require 'vagrant/util/template_renderer'
module Vagrant
@ -8,7 +7,6 @@ module Vagrant
class Gentoo < Linux
# Make the TemplateRenderer top-level
include Vagrant::Util
include Vagrant::Util::LineEndingHelpers
def configure_networks(networks)
# Remove any previous host only network additions to the interface file
@ -20,11 +18,9 @@ module Vagrant
entry = TemplateRenderer.render("guests/gentoo/network_#{network[:type]}",
:options => network)
# Convert to proper lineendings
entry = dos_to_unix(entry)
# Upload the entry to a temporary location
temp = Tempfile.new("vagrant")
temp.binmode
temp.write(entry)
temp.close

View File

@ -1,7 +1,6 @@
require 'set'
require 'tempfile'
require 'vagrant/util/line_ending_helpers'
require 'vagrant/util/template_renderer'
module Vagrant
@ -9,7 +8,6 @@ module Vagrant
class Redhat < Linux
# Make the TemplateRenderer top-level
include Vagrant::Util
include Vagrant::Util::LineEndingHelpers
def configure_networks(networks)
# Accumulate the configurations to add to the interfaces file as
@ -30,10 +28,8 @@ module Vagrant
entry = TemplateRenderer.render("guests/redhat/network_#{network[:type]}",
:options => network)
# Convert line endings to unix-style
entry = dos_to_unix(entry)
temp = Tempfile.new("vagrant")
temp.binmode
temp.write(entry)
temp.close

View File

@ -8,7 +8,7 @@ module Vagrant
super
# Emit an upstart event if upstart is available
@vm.channel.sudo("[ -x /sbin/initctl ] && /sbin/initctl emit vagrant-mounted MOUNTPOINT=#{guestpath}")
vm.channel.sudo("[ -x /sbin/initctl ] && /sbin/initctl emit vagrant-mounted MOUNTPOINT=#{guestpath}")
end
def change_host_name(name)