Skip to content

Instantly share code, notes, and snippets.

@Sharpie
Last active December 19, 2015 01:09
Show Gist options
  • Save Sharpie/5873519 to your computer and use it in GitHub Desktop.
Save Sharpie/5873519 to your computer and use it in GitHub Desktop.
Vagrant Patches
Fixes fedora network configuration.
Sourced from: https://github.com/mitchellh/vagrant/pull/1738.patch
Index: vagrant-1.2.2/templates/guests/fedora/network_static.erb
===================================================================
--- vagrant-1.2.2.orig/templates/guests/fedora/network_static.erb
+++ vagrant-1.2.2/templates/guests/fedora/network_static.erb
@@ -5,7 +5,7 @@ BOOTPROTO=none
ONBOOT=yes
IPADDR=<%= options[:ip] %>
NETMASK=<%= options[:netmask] %>
-DEVICE=p7p<%= options[:interface] %>
+DEVICE=eth<%= options[:interface] %>
<%= options[:gateway] ? "GATEWAY=#{options[:gateway]}" : '' %>
<%= options[:mac_address] ? "HWADDR=#{options[:mac_address]}" : '' %>
<%= options[:dns1] ? "DNS1=#{options[:dns1]}" : 'DNS1=8.8.4.4' %>
Fixes a regression in Vagrant 1.2.0 where config.vm.guest was ignored.
Reduced from: https://github.com/mitchellh/vagrant/commit/80f0660.patch
Index: vagrant-1.2.2/config/default.rb
===================================================================
--- vagrant-1.2.2.orig/config/default.rb
+++ vagrant-1.2.2/config/default.rb
@@ -16,7 +16,6 @@ Vagrant.configure("2") do |config|
config.vm.base_mac = nil
config.vm.graceful_halt_retry_count = 60
config.vm.graceful_halt_retry_interval = 1
- config.vm.guest = :linux
# Share SSH locally by default
config.vm.network :forwarded_port,
Index: vagrant-1.2.2/lib/vagrant/guest.rb
===================================================================
--- vagrant-1.2.2.orig/lib/vagrant/guest.rb
+++ vagrant-1.2.2/lib/vagrant/guest.rb
@@ -69,7 +69,16 @@ module Vagrant
guest_info = @guests[name]
guest = guest_info[0].new
- if guest.detect?(@machine)
+ # If a specific guest was specified, then attempt to use that
+ # guest no matter what. Otherwise, only use it if it was detected.
+ use_this_guest = false
+ if @machine.config.vm.guest.nil?
+ use_this_guest = guest.detect?(@machine)
+ else
+ use_this_guest = @machine.config.vm.guest.to_sym == name.to_sym
+ end
+
+ if use_this_guest
@logger.info("Detected: #{name}!")
@chain << [name, guest]
@name = name
Index: vagrant-1.2.2/plugins/kernel_v2/config/vm.rb
===================================================================
--- vagrant-1.2.2.orig/plugins/kernel_v2/config/vm.rb
+++ vagrant-1.2.2/plugins/kernel_v2/config/vm.rb
@@ -26,6 +26,7 @@ module VagrantPlugins
def initialize
@graceful_halt_retry_count = UNSET_VALUE
@graceful_halt_retry_interval = UNSET_VALUE
+ @guest = UNSET_VALUE
@hostname = UNSET_VALUE
@provisioners = []
@@ -225,8 +226,12 @@ module VagrantPlugins
def finalize!
# Defaults
+ @guest = nil if @guest == UNSET_VALUE
@hostname = nil if @hostname == UNSET_VALUE
+ # Set the guest properly
+ @guest = @guest.to_sym if @guest
+
# If we haven't defined a single VM, then we need to define a
# default VM which just inherits the rest of the configuration.
define(DEFAULT_VM_NAME) if defined_vm_keys.empty?
Fixes a bug where Vagrant was assuming GNU uname existed on Solaris
Sourced from: https://github.com/mitchellh/vagrant/pull/1714.patch
Index: vagrant-1.2.2/plugins/guests/solaris/guest.rb
===================================================================
--- vagrant-1.2.2.orig/plugins/guests/solaris/guest.rb
+++ vagrant-1.2.2/plugins/guests/solaris/guest.rb
@@ -7,7 +7,7 @@ module VagrantPlugins
# Contributed by Blake Irvin <[email protected]>
class Guest < Vagrant.plugin("2", :guest)
def detect?(machine)
- machine.communicate.test("uname -o | grep Solaris")
+ machine.communicate.test("uname -s | grep SunOS")
end
end
end
fix-guest-specification
fix-solaris-detection
fix-fedora-networking
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment