From 270913b7b92c388e0abeb366c37706aa8e99ff20 Mon Sep 17 00:00:00 2001 From: Govinda Fichtner Date: Tue, 7 May 2013 11:38:46 +0200 Subject: [PATCH 01/25] fix uninitialized constant error for gentoo plugin --- plugins/guests/gentoo/cap/change_host_name.rb | 2 +- plugins/guests/gentoo/cap/configure_networks.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/guests/gentoo/cap/change_host_name.rb b/plugins/guests/gentoo/cap/change_host_name.rb index 4c0f50d8f..a8112b7d5 100644 --- a/plugins/guests/gentoo/cap/change_host_name.rb +++ b/plugins/guests/gentoo/cap/change_host_name.rb @@ -1,5 +1,5 @@ module VagrantPlugins - module GuestFreeBSD + module GuestGentoo module Cap class ChangeHostName def self.change_host_name(machine, name) diff --git a/plugins/guests/gentoo/cap/configure_networks.rb b/plugins/guests/gentoo/cap/configure_networks.rb index ce7883f8c..ad534b437 100644 --- a/plugins/guests/gentoo/cap/configure_networks.rb +++ b/plugins/guests/gentoo/cap/configure_networks.rb @@ -3,9 +3,9 @@ require "tempfile" require "vagrant/util/template_renderer" module VagrantPlugins - module GuestFreeBSD + module GuestGentoo module Cap - class ChangeHostName + class ConfigureNetworks include Vagrant::Util def self.configure_networks(machine, networks) From c47522658e5a8124e9c4d6dcca62714686a32497 Mon Sep 17 00:00:00 2001 From: Andrzej Szeszo Date: Fri, 10 May 2013 15:19:47 +0200 Subject: [PATCH 02/25] #1639 Better Solaris OS detection (use portable method that actually works) --- plugins/guests/solaris/guest.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/guests/solaris/guest.rb b/plugins/guests/solaris/guest.rb index e0eab6709..4256c61cd 100644 --- a/plugins/guests/solaris/guest.rb +++ b/plugins/guests/solaris/guest.rb @@ -7,7 +7,7 @@ module VagrantPlugins # Contributed by Blake Irvin 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 From dbfce678bf3b5a7ac267e7263e824034e5d2ac94 Mon Sep 17 00:00:00 2001 From: Alper Kanat Date: Fri, 24 May 2013 00:16:26 +0300 Subject: [PATCH 03/25] fixed networking issues of Arch Linux with netctl changes --- plugins/guests/arch/cap/configure_networks.rb | 5 +++-- templates/guests/arch/network_dhcp.erb | 8 ++++---- templates/guests/arch/network_static.erb | 11 +++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/plugins/guests/arch/cap/configure_networks.rb b/plugins/guests/arch/cap/configure_networks.rb index 11fda5ded..a7cbfd5a3 100644 --- a/plugins/guests/arch/cap/configure_networks.rb +++ b/plugins/guests/arch/cap/configure_networks.rb @@ -13,8 +13,9 @@ module VagrantPlugins temp.close machine.communicate.upload(temp.path, "/tmp/vagrant_network") - machine.communicate.sudo("mv /tmp/vagrant_network /etc/network.d/interfaces/eth#{network[:interface]}") - machine.communicate.sudo("netcfg interfaces/eth#{network[:interface]}") + machine.communicate.sudo("ln -sf /dev/null /etc/udev/rules.d/80-net-name-slot.rules") + machine.communicate.sudo("mv /tmp/vagrant_network /etc/netctl/eth#{network[:interface]}") + machine.communicate.sudo("netctl start eth#{network[:interface]}") end end end diff --git a/templates/guests/arch/network_dhcp.erb b/templates/guests/arch/network_dhcp.erb index f7044f071..cea4e8587 100644 --- a/templates/guests/arch/network_dhcp.erb +++ b/templates/guests/arch/network_dhcp.erb @@ -1,4 +1,4 @@ -CONNECTION='ethernet' -DESCRIPTION='A basic dhcp ethernet connection' -INTERFACE='eth<%= options[:interface] %>' -IP='dhcp' +Description='A basic dhcp ethernet connection' +Interface=eth<%= options[:interface] %> +Connection=ethernet +IP=dhcp diff --git a/templates/guests/arch/network_static.erb b/templates/guests/arch/network_static.erb index 61dfc140b..6cf2b9a62 100644 --- a/templates/guests/arch/network_static.erb +++ b/templates/guests/arch/network_static.erb @@ -1,6 +1,5 @@ -CONNECTION='ethernet' -DESCRIPTION='A basic static ethernet connection' -INTERFACE='eth<%= options[:interface] %>' -IP='static' -ADDR='<%= options[:ip]%>' -NETMASK='<%= options[:netmask] %>' +Connection=ethernet +Description='A basic static ethernet connection' +Interface=eth<%= options[:interface] %> +IP=static +Address=('<%= options[:ip]%>/24') From 898bff4442f579d34ce6f54334ab5d733f3c9001 Mon Sep 17 00:00:00 2001 From: Eugene Kalinin Date: Fri, 24 May 2013 13:45:44 +0400 Subject: [PATCH 04/25] Improved autocompletion for bash --- contrib/bash/completion.sh | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/contrib/bash/completion.sh b/contrib/bash/completion.sh index 40d12d3fb..fb6fc508a 100644 --- a/contrib/bash/completion.sh +++ b/contrib/bash/completion.sh @@ -1,3 +1,31 @@ # Autocompletion for Vagrant just put this line in your ~/.profile or link this file into it like: # source /path/to/vagrant/contrib/bash/completion.sh -complete -W "$(echo `vagrant --help | awk '/^ /{print $1}'`;)" vagrant +_vagrant() { + + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + preprev="${COMP_WORDS[COMP_CWORD-2]}" + + commands=$(vagrant --help | awk '/^ /{print $1}') + + if [ $COMP_CWORD == 1 ] ; then + COMPREPLY=( $(compgen -W "${commands}" -- ${cur}) ) + return 0 + fi + + if [ $COMP_CWORD == 2 ] ; then + local sub_commands=$(vagrant $prev --help | awk '/^ /{print $1}') + COMPREPLY=( $(compgen -W "${sub_commands}" -- ${cur}) ) + return 0 + fi + + if [[ ${cur} == -* ]] ; then + local command_opts=$(vagrant $preprev $prev --help | grep -E -o "((-\w{1}|--(\w|-)*=?)){1,2}") + COMPREPLY=( $(compgen -W "${command_opts}" -- ${cur}) ) + return 0 + fi +} + +complete -F _vagrant vagrant + +# /* vim: set filetype=sh : */ From 497ebb0f72c2a5dfe211a211348c4149830bff79 Mon Sep 17 00:00:00 2001 From: Deepak Seshadri Date: Fri, 31 May 2013 19:31:43 +1000 Subject: [PATCH 05/25] Fix setting persistent hostname on SLES guests. --- plugins/guests/suse/cap/change_host_name.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/guests/suse/cap/change_host_name.rb b/plugins/guests/suse/cap/change_host_name.rb index 3616171bf..a8ba242d7 100644 --- a/plugins/guests/suse/cap/change_host_name.rb +++ b/plugins/guests/suse/cap/change_host_name.rb @@ -6,7 +6,7 @@ module VagrantPlugins machine.communicate.tap do |comm| # Only do this if the hostname is not already set if !comm.test("sudo hostname | grep '#{name}'") - comm.sudo("sed -i 's/\\(HOSTNAME=\\).*/\\1#{name}/' /etc/sysconfig/network") + comm.sudo("echo #{name} > /etc/HOSTNAME") comm.sudo("hostname #{name}") comm.sudo("sed -i 's@^\\(127[.]0[.]0[.]1[[:space:]]\\+\\)@\\1#{name} #{name.split('.')[0]} @' /etc/hosts") end From 093626731455ab24f31127205e2a504e8a0acb81 Mon Sep 17 00:00:00 2001 From: Gabor Nagy Date: Sat, 1 Jun 2013 14:29:45 +0200 Subject: [PATCH 06/25] Fixes [GH-654] on Windows 8x64 and Ruby 1.9.3p374 Replaces the command with absolute path version if it exists. --- lib/vagrant/util/subprocess.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/vagrant/util/subprocess.rb b/lib/vagrant/util/subprocess.rb index 4379304b8..8003cdc0f 100644 --- a/lib/vagrant/util/subprocess.rb +++ b/lib/vagrant/util/subprocess.rb @@ -26,6 +26,11 @@ module Vagrant def initialize(*command) @options = command.last.is_a?(Hash) ? command.pop : {} @command = command + if Platform.windows? + locations = `where #{command[0]}` + new_command = "#{locations.split("\n")[0]}" + @command[0] = new_command if $?.success? and File.exists?(new_command) + end @logger = Log4r::Logger.new("vagrant::util::subprocess") end From 6d33fe440cba82fa2fc555ee6a657e43b46b4c03 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 1 Jun 2013 17:44:25 -0700 Subject: [PATCH 07/25] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4f320aa9..cc5aa4c9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ BUG FIXES: defined. [GH-1665] - Finding V1 boxes now works properly again to avoid "box not found" errors. [GH-1691] + - Setting hostname on SLES 11 works again. [GH-1781] ## 1.2.2 (April 23, 2013) From 4c00abe69eba77c36823c6ea09aa07d8aedf9445 Mon Sep 17 00:00:00 2001 From: Gabor Nagy Date: Sun, 2 Jun 2013 03:48:47 +0200 Subject: [PATCH 08/25] Modifies to use util/which [GH-654] --- lib/vagrant/errors.rb | 8 ++++++++ lib/vagrant/util/subprocess.rb | 9 +++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/vagrant/errors.rb b/lib/vagrant/errors.rb index 1377464bb..dc24536d3 100644 --- a/lib/vagrant/errors.rb +++ b/lib/vagrant/errors.rb @@ -163,6 +163,14 @@ module Vagrant error_key(:cli_invalid_options) end + class CommandUnavailable < VagrantError + error_key(:command_unavailable) + end + + class CommandUnavailableWindows < VagrantError + error_key(:command_unavailable_windows) + end + class ConfigInvalid < VagrantError error_key(:config_invalid) end diff --git a/lib/vagrant/util/subprocess.rb b/lib/vagrant/util/subprocess.rb index 8003cdc0f..c0e776449 100644 --- a/lib/vagrant/util/subprocess.rb +++ b/lib/vagrant/util/subprocess.rb @@ -5,6 +5,7 @@ require 'log4r' require 'vagrant/util/platform' require 'vagrant/util/safe_chdir' +require 'vagrant/util/which' module Vagrant module Util @@ -26,10 +27,10 @@ module Vagrant def initialize(*command) @options = command.last.is_a?(Hash) ? command.pop : {} @command = command - if Platform.windows? - locations = `where #{command[0]}` - new_command = "#{locations.split("\n")[0]}" - @command[0] = new_command if $?.success? and File.exists?(new_command) + @command[0] = Which.which(@command[0]) + unless @command[0] + raise Errors::CommandUnavailableWindows if Platform.windows? + raise Errors::CommandUnavailable end @logger = Log4r::Logger.new("vagrant::util::subprocess") end From a4979c4824354e956370b848ecc6715f25d14cb5 Mon Sep 17 00:00:00 2001 From: Gabor Nagy Date: Mon, 3 Jun 2013 00:04:25 +0200 Subject: [PATCH 09/25] [GH-654] Missing condition and translations --- lib/vagrant/util/subprocess.rb | 2 +- templates/locales/en.yml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/vagrant/util/subprocess.rb b/lib/vagrant/util/subprocess.rb index c0e776449..c9be8eafe 100644 --- a/lib/vagrant/util/subprocess.rb +++ b/lib/vagrant/util/subprocess.rb @@ -27,7 +27,7 @@ module Vagrant def initialize(*command) @options = command.last.is_a?(Hash) ? command.pop : {} @command = command - @command[0] = Which.which(@command[0]) + @command[0] = Which.which(@command[0]) unless File.exists? @command[0] unless @command[0] raise Errors::CommandUnavailableWindows if Platform.windows? raise Errors::CommandUnavailable diff --git a/templates/locales/en.yml b/templates/locales/en.yml index b5d423b0b..c4963e8b9 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -167,6 +167,8 @@ en: available below. %{help} + command_unavailable: "command binary could not be found. Is this application installed?" + command_unavailable_windows: "command executable not found in any directories in the %PATH% variable." config_invalid: |- There are errors in the configuration of this machine. Please fix the following errors and try again: From 4b9c21b5a6212c553c28603666b11e94c50c0917 Mon Sep 17 00:00:00 2001 From: Marcel Hecko Date: Wed, 5 Jun 2013 14:10:24 +0200 Subject: [PATCH 10/25] [status command print formatting] the result line needs space between the name of the VM and short_description - otherwise the formatting of the output breaks when the name of the VM is too long - the name of the VM gets smashed together with the short_description rendering --- plugins/commands/status/command.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/commands/status/command.rb b/plugins/commands/status/command.rb index 6c11ae400..90b7b8584 100644 --- a/plugins/commands/status/command.rb +++ b/plugins/commands/status/command.rb @@ -16,7 +16,7 @@ module VagrantPlugins results = [] with_target_vms(argv) do |machine| state = machine.state if !state - results << "#{machine.name.to_s.ljust(25)}#{machine.state.short_description} (#{machine.provider_name})" + results << "#{machine.name.to_s.ljust(25)} #{machine.state.short_description} (#{machine.provider_name})" end message = nil From dab0faf6b5fb46c38f3b350550829e74082bdd18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Fri, 7 Jun 2013 19:02:49 +0300 Subject: [PATCH 11/25] add ssh agent sample to Vagrantfile --- templates/commands/init/Vagrantfile.erb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/commands/init/Vagrantfile.erb b/templates/commands/init/Vagrantfile.erb index 205a88164..6f2a3debc 100644 --- a/templates/commands/init/Vagrantfile.erb +++ b/templates/commands/init/Vagrantfile.erb @@ -27,6 +27,10 @@ Vagrant.configure("2") do |config| # your network. # config.vm.network :public_network + # If true, then any SSH connections made will enable agent forwarding. + # Default value: false + # config.ssh.forward_agent = true + # Share an additional folder to the guest VM. The first argument is # the path on the host to the actual folder. The second argument is # the path on the guest to mount the folder. And the optional third From 1029538b2484a368d06fa153fd79e00db382bffc Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Sun, 9 Jun 2013 14:14:33 -0400 Subject: [PATCH 12/25] Set ARPCHECK=no as an environment variable with doing ifup #921 --- plugins/guests/redhat/cap/configure_networks.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/guests/redhat/cap/configure_networks.rb b/plugins/guests/redhat/cap/configure_networks.rb index 227fecfa6..e028fdfc9 100644 --- a/plugins/guests/redhat/cap/configure_networks.rb +++ b/plugins/guests/redhat/cap/configure_networks.rb @@ -48,7 +48,7 @@ module VagrantPlugins retryable(:on => Vagrant::Errors::VagrantError, :tries => 3, :sleep => 2) do machine.communicate.sudo("/sbin/ifdown eth#{interface} 2> /dev/null", :error_check => false) machine.communicate.sudo("cat /tmp/vagrant-network-entry_#{interface} >> #{network_scripts_dir}/ifcfg-eth#{interface}") - machine.communicate.sudo("/sbin/ifup eth#{interface} 2> /dev/null") + machine.communicate.sudo("ARPCHECK=no /sbin/ifup eth#{interface} 2> /dev/null") end machine.communicate.sudo("rm /tmp/vagrant-network-entry_#{interface}") From 2209204cf2c340a71353e78d7ca92c5620924cfc Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 9 Jun 2013 13:10:51 -0700 Subject: [PATCH 13/25] Update CHANGELOG --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc5aa4c9e..c896848eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ IMPROVEMENTS: within an LXC container works properly now. - Allow strings in addition to symbols to more places in V1 configuration as well as V2 configuration. + - Add `ARPCHECK=0` to RedHat OS family network configuration. [GH-1815] + - Add SSH agent forwarding sample to initial Vagrantfile. [GH-1808] BUG FIXES: From 80f06605fbf7ac1bc200a2a01dff929079e22f40 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 9 Jun 2013 13:17:23 -0700 Subject: [PATCH 14/25] config.vm.guest now forces guest setting again [GH-1800] --- CHANGELOG.md | 1 + config/default.rb | 1 - lib/vagrant/guest.rb | 11 ++++++++++- plugins/kernel_v2/config/vm.rb | 5 +++++ test/unit/vagrant/guest_test.rb | 13 +++++++++++++ 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c896848eb..5951b55e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ BUG FIXES: - Finding V1 boxes now works properly again to avoid "box not found" errors. [GH-1691] - Setting hostname on SLES 11 works again. [GH-1781] + - `config.vm.guest` properly forces guests again. [GH-1800] ## 1.2.2 (April 23, 2013) diff --git a/config/default.rb b/config/default.rb index 97f92fc53..d4cb3aa87 100644 --- a/config/default.rb +++ b/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, diff --git a/lib/vagrant/guest.rb b/lib/vagrant/guest.rb index ad4f06ecb..1c0dab158 100644 --- a/lib/vagrant/guest.rb +++ b/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 diff --git a/plugins/kernel_v2/config/vm.rb b/plugins/kernel_v2/config/vm.rb index 89f70b5c5..e57042f61 100644 --- a/plugins/kernel_v2/config/vm.rb +++ b/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? diff --git a/test/unit/vagrant/guest_test.rb b/test/unit/vagrant/guest_test.rb index d778ccd05..b66ccc708 100644 --- a/test/unit/vagrant/guest_test.rb +++ b/test/unit/vagrant/guest_test.rb @@ -10,6 +10,9 @@ describe Vagrant::Guest do let(:machine) do double("machine").tap do |m| m.stub(:inspect => "machine") + m.stub(:config => double("config")) + m.config.stub(:vm => double("vm_config")) + m.config.vm.stub(:guest => nil) end end @@ -143,6 +146,16 @@ describe Vagrant::Guest do subject.chain.map { |x| x[1] }.map(&:name).should == [:baz, :bar, :foo] end + it "detects the forced guest setting" do + register_guest(:foo, nil, false) + register_guest(:bar, nil, false) + + machine.config.vm.stub(:guest => :bar) + + subject.detect! + subject.name.should == :bar + end + it "raises an exception if no guest can be detected" do expect { subject.detect! }. to raise_error(Vagrant::Errors::GuestNotDetected) From 5e48391b05ce3ff864547497502bcff73e1227af Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 9 Jun 2013 13:27:08 -0700 Subject: [PATCH 15/25] read_ip_address linux cap only reads ip of first device [GH-1799] --- CHANGELOG.md | 2 ++ plugins/guests/linux/cap/read_ip_address.rb | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5951b55e2..7836e74a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,8 @@ BUG FIXES: errors. [GH-1691] - Setting hostname on SLES 11 works again. [GH-1781] - `config.vm.guest` properly forces guests again. [GH-1800] + - The `read_ip_address` capability for linux properly reads the IP + of only the first network interface. [GH-1799] ## 1.2.2 (April 23, 2013) diff --git a/plugins/guests/linux/cap/read_ip_address.rb b/plugins/guests/linux/cap/read_ip_address.rb index 0eaffccbf..c6adc9e16 100644 --- a/plugins/guests/linux/cap/read_ip_address.rb +++ b/plugins/guests/linux/cap/read_ip_address.rb @@ -3,13 +3,13 @@ module VagrantPlugins module Cap class ReadIPAddress def self.read_ip_address(machine) - command = "ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'" + command = "ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1 }'" result = "" machine.communicate.execute(command) do |type, data| result << data if type == :stdout end - result.chomp + result.chomp.split("\n").first end end end From 3d1332c86f60a6c612165bfd672cfd362c0e1eb8 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 9 Jun 2013 13:37:15 -0700 Subject: [PATCH 16/25] virtualbox: only configure networks if there are some [GH-1796] --- CHANGELOG.md | 3 +++ plugins/providers/virtualbox/action/network.rb | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7836e74a7..ada510468 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,9 @@ IMPROVEMENTS: as well as V2 configuration. - Add `ARPCHECK=0` to RedHat OS family network configuration. [GH-1815] - Add SSH agent forwarding sample to initial Vagrantfile. [GH-1808] + - VirtualBox: Only configure networks if there are any to configure. + This allows linux's that don't implement this capability to work with + Vagrant. [GH-1796] BUG FIXES: diff --git a/plugins/providers/virtualbox/action/network.rb b/plugins/providers/virtualbox/action/network.rb index 591583ffc..11409be3c 100644 --- a/plugins/providers/virtualbox/action/network.rb +++ b/plugins/providers/virtualbox/action/network.rb @@ -111,8 +111,10 @@ module VagrantPlugins # Only configure the networks the user requested us to configure networks_to_configure = networks.select { |n| n[:auto_config] } - env[:ui].info I18n.t("vagrant.actions.vm.network.configuring") - env[:machine].guest.capability(:configure_networks, networks_to_configure) + if !networks_to_configure.empty? + env[:ui].info I18n.t("vagrant.actions.vm.network.configuring") + env[:machine].guest.capability(:configure_networks, networks_to_configure) + end end end From cf2f6da4dbcb4f57c9cdb3b94dcd0bba62c5f5fd Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 9 Jun 2013 13:46:46 -0700 Subject: [PATCH 17/25] Validate an IP is given for a private network [GH-1788] --- CHANGELOG.md | 1 + plugins/kernel_v2/config/vm.rb | 8 ++++++++ templates/locales/en.yml | 2 ++ 3 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ada510468..bba9c9a50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ BUG FIXES: - `config.vm.guest` properly forces guests again. [GH-1800] - The `read_ip_address` capability for linux properly reads the IP of only the first network interface. [GH-1799] + - Validate that an IP is given for a private network. [GH-1788] ## 1.2.2 (April 23, 2013) diff --git a/plugins/kernel_v2/config/vm.rb b/plugins/kernel_v2/config/vm.rb index e57042f61..e77cce812 100644 --- a/plugins/kernel_v2/config/vm.rb +++ b/plugins/kernel_v2/config/vm.rb @@ -385,6 +385,14 @@ module VagrantPlugins fp_host_ports.add(options[:host]) end end + + if type == :private_network + if options[:type] != :dhcp + if !options[:ip] + errors << I18n.t("vagrant.config.vm.network_ip_required") + end + end + end end # We're done with VM level errors so prepare the section diff --git a/templates/locales/en.yml b/templates/locales/en.yml index b5d423b0b..43f7ce41b 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -613,6 +613,8 @@ en: nfs_requires_host: |- Using NFS shared folders requires a host to be specified using `config.vagrant.host`. + network_ip_required: |- + An IP is required for a private network. network_fp_host_not_unique: |- Forwarded port '%{host}' (host port) is declared multiple times network_fp_requires_ports: |- From 6c99f3dfa7d8f8c97006f15839f069f841653b03 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 9 Jun 2013 13:51:14 -0700 Subject: [PATCH 18/25] tweaks for style --- lib/vagrant/util/subprocess.rb | 9 +++++---- templates/locales/en.yml | 10 ++++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/vagrant/util/subprocess.rb b/lib/vagrant/util/subprocess.rb index c9be8eafe..f733ed3ce 100644 --- a/lib/vagrant/util/subprocess.rb +++ b/lib/vagrant/util/subprocess.rb @@ -27,11 +27,12 @@ module Vagrant def initialize(*command) @options = command.last.is_a?(Hash) ? command.pop : {} @command = command - @command[0] = Which.which(@command[0]) unless File.exists? @command[0] - unless @command[0] - raise Errors::CommandUnavailableWindows if Platform.windows? - raise Errors::CommandUnavailable + @command[0] = Which.which(@command[0]) if !File.file? @command[0] + if !@command[0] + raise Errors::CommandUnavailableWindows, file: command[0] if Platform.windows? + raise Errors::CommandUnavailable, file: command[0] end + @logger = Log4r::Logger.new("vagrant::util::subprocess") end diff --git a/templates/locales/en.yml b/templates/locales/en.yml index 06979f7b7..070e2a05f 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -167,8 +167,14 @@ en: available below. %{help} - command_unavailable: "command binary could not be found. Is this application installed?" - command_unavailable_windows: "command executable not found in any directories in the %PATH% variable." + command_unavailable: |- + The executable '%(file)' Vagrant is trying to run was not + found in the PATH variable. This is an error. Please verify + this software is installed and on the path. + command_unavailable_windows: |- + The executable '%(file)' Vagrant is trying to run was not + found in the %PATH% variable. This is an error. Please verify + this software is installed and on the path. config_invalid: |- There are errors in the configuration of this machine. Please fix the following errors and try again: From ba91602628d1430a3f53229f9668483fe57c1669 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 9 Jun 2013 15:15:59 -0700 Subject: [PATCH 19/25] Bind default SSH to 127.0.0.1 [GH-1785] --- CHANGELOG.md | 3 +++ config/default.rb | 1 + plugins/providers/virtualbox/action/forward_ports.rb | 1 + plugins/providers/virtualbox/driver/version_4_2.rb | 4 ++-- plugins/providers/virtualbox/model/forwarded_port.rb | 6 ++++++ 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bba9c9a50..4ae6b09d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ FEATURES: - Added a `working_directory` configuration option to the Puppet apply provisioner so you can specify the working directory when `puppet` is called, making it friendly to Hiera data and such. [GH-1670] + - Ability to specify the host IP to bind forwarded ports to. [GH-1785] IMPROVEMENTS: @@ -23,6 +24,8 @@ IMPROVEMENTS: - VirtualBox: Only configure networks if there are any to configure. This allows linux's that don't implement this capability to work with Vagrant. [GH-1796] + - Default SSH forwarded port now binds to 127.0.0.1 so only local + connections are allowed. [GH-1785] BUG FIXES: diff --git a/config/default.rb b/config/default.rb index d4cb3aa87..95cc6ab6c 100644 --- a/config/default.rb +++ b/config/default.rb @@ -21,6 +21,7 @@ Vagrant.configure("2") do |config| config.vm.network :forwarded_port, guest: 22, host: 2222, + host_ip: "127.0.0.1", id: "ssh", auto_correct: true diff --git a/plugins/providers/virtualbox/action/forward_ports.rb b/plugins/providers/virtualbox/action/forward_ports.rb index ee64d7988..da4da6eb8 100644 --- a/plugins/providers/virtualbox/action/forward_ports.rb +++ b/plugins/providers/virtualbox/action/forward_ports.rb @@ -70,6 +70,7 @@ module VagrantPlugins ports << { :adapter => fp.adapter, :guestport => fp.guest_port, + :hostip => fp.host_ip, :hostport => fp.host_port, :name => fp.id, :protocol => fp.protocol diff --git a/plugins/providers/virtualbox/driver/version_4_2.rb b/plugins/providers/virtualbox/driver/version_4_2.rb index dded1bc6f..f72ff0b52 100644 --- a/plugins/providers/virtualbox/driver/version_4_2.rb +++ b/plugins/providers/virtualbox/driver/version_4_2.rb @@ -140,9 +140,9 @@ module VagrantPlugins ports.each do |options| pf_builder = [options[:name], options[:protocol] || "tcp", - "", + options[:hostip] || "", options[:hostport], - "", + options[:guestip] || "", options[:guestport]] args.concat(["--natpf#{options[:adapter] || 1}", diff --git a/plugins/providers/virtualbox/model/forwarded_port.rb b/plugins/providers/virtualbox/model/forwarded_port.rb index 88c5c115d..5f8e8ed84 100644 --- a/plugins/providers/virtualbox/model/forwarded_port.rb +++ b/plugins/providers/virtualbox/model/forwarded_port.rb @@ -29,6 +29,11 @@ module VagrantPlugins # @return [Integer] attr_reader :guest_port + # The IP that the forwarded port will bind to on the host machine. + # + # @return [String] + attr_reader :host_ip + # The port on the host used to access the port on the guest. # # @return [Integer] @@ -43,6 +48,7 @@ module VagrantPlugins @auto_correct = true @auto_correct = options[:auto_correct] if options.has_key?(:auto_correct) @adapter = (options[:adapter] || 1).to_i + @host_ip = options[:host_ip] || nil @protocol = options[:protocol] || "tcp" end From 0e208f490ceee62271b596be5e88122fbb6ebeb1 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 9 Jun 2013 15:53:10 -0700 Subject: [PATCH 20/25] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ae6b09d5..c06650786 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ IMPROVEMENTS: Vagrant. [GH-1796] - Default SSH forwarded port now binds to 127.0.0.1 so only local connections are allowed. [GH-1785] + - Use `netctl` for Arch Linux network configuration. [GH-1760] BUG FIXES: From 68e5e8e7400748d0232069dc1c08d80c8bbc73da Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Sun, 9 Jun 2013 20:34:15 -0300 Subject: [PATCH 21/25] Kick off CONTRIBUTING.md based on @anselmh's https://github.com/anselmh/CONTRIBUTING.md --- CONTRIBUTING.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..6a19c3f34 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,38 @@ +# How to contribute + +I like to encourage you to contribute to the repository. +This should be as easy as possible for you but there are a few things to consider when contributing. +The following guidelines for contribution should be followed if you want to submit a pull request. + +## How to prepare + +* You need a [GitHub account](https://github.com/signup/free) +* Submit an [issue ticket](https://github.com/anselmh/modx-boilerplate-evo/issues) for your issue if the is no one yet. + * Describe the issue and include steps to reproduce when it's a bug. + * Ensure to mention the earliest version that you know is affected. +* Fork the repository on GitHub + +## Make Changes + +* In your forked repository, create a topic branch for your upcoming patch. + * Usually this is based on the master branch. + * Create a branch based on master; `git branch + fix/master/my_contribution master` then checkout the new branch with `git + checkout fix/master/my_contribution`. Please avoid working directly on the `master` branch. +* Make commits of logical units and describe them properly. +* Check for unnecessary whitespace with `git diff --check` before committing. + +* If possible, submit tests to your patch / new feature so it can be tested easily. +* Assure nothing is broken by running all the tests. + +## Submit Changes + +* Push your changes to a topic branch in your fork of the repository. +* Open a pull request to the original repository and choose the right original branch you want to patch. +* If not done in commit messages (which you really should do) please reference and update your issue with the code changes. +* Even if you have write access to the repository, do not directly push or merge pull-requests. Let another team member review your pull request and approve. + +# Additional Resources + +* [General GitHub documentation](http://help.github.com/) +* [GitHub pull request documentation](http://help.github.com/send-pull-requests/) From 9b947d0c4a6f573f897e11fc49b17cb07db268b1 Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Sun, 9 Jun 2013 20:40:26 -0300 Subject: [PATCH 22/25] Change link to issue tracker on CONTRIBUTING.md --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6a19c3f34..b8d869faf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,13 +1,13 @@ # How to contribute -I like to encourage you to contribute to the repository. +We like to encourage you to contribute to the repository. This should be as easy as possible for you but there are a few things to consider when contributing. The following guidelines for contribution should be followed if you want to submit a pull request. ## How to prepare * You need a [GitHub account](https://github.com/signup/free) -* Submit an [issue ticket](https://github.com/anselmh/modx-boilerplate-evo/issues) for your issue if the is no one yet. +* Submit an [issue ticket](https://github.com/mitchellh/vagrant/issues) for your issue if the is no one yet. * Describe the issue and include steps to reproduce when it's a bug. * Ensure to mention the earliest version that you know is affected. * Fork the repository on GitHub From 2c806079c9153ea593eee3b5dc5efbbb76df9f49 Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Sun, 9 Jun 2013 20:41:26 -0300 Subject: [PATCH 23/25] Add notes about debugging logs to contributing guidelines --- CONTRIBUTING.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b8d869faf..fc5d3c576 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,6 +10,9 @@ The following guidelines for contribution should be followed if you want to subm * Submit an [issue ticket](https://github.com/mitchellh/vagrant/issues) for your issue if the is no one yet. * Describe the issue and include steps to reproduce when it's a bug. * Ensure to mention the earliest version that you know is affected. + * If you plan on submitting a bug report, please submit debug-level logs along + with the report using [gist](https://gist.github.com/) or some other paste + service by prepending `VAGRANT_LOG=debug` to your `vagrant` commands. * Fork the repository on GitHub ## Make Changes From 4c850cedbc3e55e96c0fd1f22a22629e41119733 Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Fri, 14 Jun 2013 00:13:44 -0300 Subject: [PATCH 24/25] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c06650786..06c06bd6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ BUG FIXES: - The `read_ip_address` capability for linux properly reads the IP of only the first network interface. [GH-1799] - Validate that an IP is given for a private network. [GH-1788] + - Fix uninitialized constant error for Gentoo plugin. [GH-1698] ## 1.2.2 (April 23, 2013) From 579e591dfbf6234c765e5d5b9f09458a017b10ea Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Mon, 24 Jun 2013 11:56:43 -0400 Subject: [PATCH 25/25] Remove JSON gem dependency --- vagrant.gemspec | 1 - 1 file changed, 1 deletion(-) diff --git a/vagrant.gemspec b/vagrant.gemspec index bcf427004..7a900c0b2 100644 --- a/vagrant.gemspec +++ b/vagrant.gemspec @@ -17,7 +17,6 @@ Gem::Specification.new do |s| s.add_dependency "childprocess", "~> 0.3.7" s.add_dependency "erubis", "~> 2.7.0" s.add_dependency "i18n", "~> 0.6.0" - s.add_dependency "json", ">= 1.5.1", "< 1.8.0" s.add_dependency "log4r", "~> 1.1.9" s.add_dependency "net-ssh", "~> 2.6.6" s.add_dependency "net-scp", "~> 1.1.0"