Use `binmode` to actually fix GH-727
This commit is contained in:
parent
9e427562ef
commit
b64ac0b0d3
|
@ -1,7 +1,6 @@
|
||||||
require 'set'
|
require 'set'
|
||||||
require 'tempfile'
|
require 'tempfile'
|
||||||
|
|
||||||
require 'vagrant/util/line_ending_helpers'
|
|
||||||
require 'vagrant/util/template_renderer'
|
require 'vagrant/util/template_renderer'
|
||||||
|
|
||||||
module Vagrant
|
module Vagrant
|
||||||
|
@ -9,7 +8,6 @@ module Vagrant
|
||||||
class Arch < Linux
|
class Arch < Linux
|
||||||
# Make the TemplateRenderer top-level
|
# Make the TemplateRenderer top-level
|
||||||
include Vagrant::Util
|
include Vagrant::Util
|
||||||
include Vagrant::Util::LineEndingHelpers
|
|
||||||
|
|
||||||
def change_host_name(name)
|
def change_host_name(name)
|
||||||
# Only do this if the hostname is not already set
|
# Only do this if the hostname is not already set
|
||||||
|
@ -33,14 +31,13 @@ module Vagrant
|
||||||
entry = TemplateRenderer.render("guests/arch/network_#{network[:type]}",
|
entry = TemplateRenderer.render("guests/arch/network_#{network[:type]}",
|
||||||
:options => network)
|
:options => network)
|
||||||
|
|
||||||
# Convert to proper line endings
|
|
||||||
entry = dos_to_unix(entry)
|
|
||||||
entries << entry
|
entries << entry
|
||||||
end
|
end
|
||||||
|
|
||||||
# Perform the careful dance necessary to reconfigure
|
# Perform the careful dance necessary to reconfigure
|
||||||
# the network interfaces
|
# the network interfaces
|
||||||
temp = Tempfile.new("vagrant")
|
temp = Tempfile.new("vagrant")
|
||||||
|
temp.binmode
|
||||||
temp.write(entries.join("\n"))
|
temp.write(entries.join("\n"))
|
||||||
temp.close
|
temp.close
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
require 'set'
|
require 'set'
|
||||||
require 'tempfile'
|
require 'tempfile'
|
||||||
|
|
||||||
require 'vagrant/util/line_ending_helpers'
|
|
||||||
require 'vagrant/util/template_renderer'
|
require 'vagrant/util/template_renderer'
|
||||||
|
|
||||||
module Vagrant
|
module Vagrant
|
||||||
|
@ -9,7 +8,6 @@ module Vagrant
|
||||||
class Debian < Linux
|
class Debian < Linux
|
||||||
# Make the TemplateRenderer top-level
|
# Make the TemplateRenderer top-level
|
||||||
include Vagrant::Util
|
include Vagrant::Util
|
||||||
include Vagrant::Util::LineEndingHelpers
|
|
||||||
|
|
||||||
def configure_networks(networks)
|
def configure_networks(networks)
|
||||||
# First, remove any previous network modifications
|
# First, remove any previous network modifications
|
||||||
|
@ -27,14 +25,13 @@ module Vagrant
|
||||||
entry = TemplateRenderer.render("guests/debian/network_#{network[:type]}",
|
entry = TemplateRenderer.render("guests/debian/network_#{network[:type]}",
|
||||||
:options => network)
|
:options => network)
|
||||||
|
|
||||||
# Convert line endings properly and save
|
|
||||||
entry = dos_to_unix(entry)
|
|
||||||
entries << entry
|
entries << entry
|
||||||
end
|
end
|
||||||
|
|
||||||
# Perform the careful dance necessary to reconfigure
|
# Perform the careful dance necessary to reconfigure
|
||||||
# the network interfaces
|
# the network interfaces
|
||||||
temp = Tempfile.new("vagrant")
|
temp = Tempfile.new("vagrant")
|
||||||
|
temp.binmode
|
||||||
temp.write(entries.join("\n"))
|
temp.write(entries.join("\n"))
|
||||||
temp.close
|
temp.close
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
require 'tempfile'
|
require 'tempfile'
|
||||||
|
|
||||||
require 'vagrant/util/line_ending_helpers'
|
|
||||||
require 'vagrant/util/template_renderer'
|
require 'vagrant/util/template_renderer'
|
||||||
|
|
||||||
module Vagrant
|
module Vagrant
|
||||||
|
@ -8,7 +7,6 @@ module Vagrant
|
||||||
class Gentoo < Linux
|
class Gentoo < Linux
|
||||||
# Make the TemplateRenderer top-level
|
# Make the TemplateRenderer top-level
|
||||||
include Vagrant::Util
|
include Vagrant::Util
|
||||||
include Vagrant::Util::LineEndingHelpers
|
|
||||||
|
|
||||||
def configure_networks(networks)
|
def configure_networks(networks)
|
||||||
# Remove any previous host only network additions to the interface file
|
# 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]}",
|
entry = TemplateRenderer.render("guests/gentoo/network_#{network[:type]}",
|
||||||
:options => network)
|
:options => network)
|
||||||
|
|
||||||
# Convert to proper lineendings
|
|
||||||
entry = dos_to_unix(entry)
|
|
||||||
|
|
||||||
# Upload the entry to a temporary location
|
# Upload the entry to a temporary location
|
||||||
temp = Tempfile.new("vagrant")
|
temp = Tempfile.new("vagrant")
|
||||||
|
temp.binmode
|
||||||
temp.write(entry)
|
temp.write(entry)
|
||||||
temp.close
|
temp.close
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
require 'set'
|
require 'set'
|
||||||
require 'tempfile'
|
require 'tempfile'
|
||||||
|
|
||||||
require 'vagrant/util/line_ending_helpers'
|
|
||||||
require 'vagrant/util/template_renderer'
|
require 'vagrant/util/template_renderer'
|
||||||
|
|
||||||
module Vagrant
|
module Vagrant
|
||||||
|
@ -9,7 +8,6 @@ module Vagrant
|
||||||
class Redhat < Linux
|
class Redhat < Linux
|
||||||
# Make the TemplateRenderer top-level
|
# Make the TemplateRenderer top-level
|
||||||
include Vagrant::Util
|
include Vagrant::Util
|
||||||
include Vagrant::Util::LineEndingHelpers
|
|
||||||
|
|
||||||
def configure_networks(networks)
|
def configure_networks(networks)
|
||||||
# Accumulate the configurations to add to the interfaces file as
|
# Accumulate the configurations to add to the interfaces file as
|
||||||
|
@ -30,10 +28,8 @@ module Vagrant
|
||||||
entry = TemplateRenderer.render("guests/redhat/network_#{network[:type]}",
|
entry = TemplateRenderer.render("guests/redhat/network_#{network[:type]}",
|
||||||
:options => network)
|
:options => network)
|
||||||
|
|
||||||
# Convert line endings to unix-style
|
|
||||||
entry = dos_to_unix(entry)
|
|
||||||
|
|
||||||
temp = Tempfile.new("vagrant")
|
temp = Tempfile.new("vagrant")
|
||||||
|
temp.binmode
|
||||||
temp.write(entry)
|
temp.write(entry)
|
||||||
temp.close
|
temp.close
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ module Vagrant
|
||||||
super
|
super
|
||||||
|
|
||||||
# Emit an upstart event if upstart is available
|
# 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
|
end
|
||||||
|
|
||||||
def change_host_name(name)
|
def change_host_name(name)
|
||||||
|
|
Loading…
Reference in New Issue