From e0c716e454bd7638a38b28208a71e16a1488147c Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 4 Jan 2011 20:10:34 -0800 Subject: [PATCH 1/3] Fix automount select to accept key/val instead of just val --- lib/vagrant/action/vm/nfs.rb | 2 +- test/vagrant/action/vm/nfs_test.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/vagrant/action/vm/nfs.rb b/lib/vagrant/action/vm/nfs.rb index 020036b93..e543b8556 100644 --- a/lib/vagrant/action/vm/nfs.rb +++ b/lib/vagrant/action/vm/nfs.rb @@ -114,7 +114,7 @@ module Vagrant @env.ui.info I18n.t("vagrant.actions.vm.nfs.mounting") # Only mount the folders which have a guest path specified - am_folders = folders.select { |folder| folder[:guestpath] } + am_folders = folders.select { |name, folder| folder[:guestpath] } @env["vm"].system.mount_nfs(host_ip, am_folders) end diff --git a/test/vagrant/action/vm/nfs_test.rb b/test/vagrant/action/vm/nfs_test.rb index b6f5efcee..5b0374846 100644 --- a/test/vagrant/action/vm/nfs_test.rb +++ b/test/vagrant/action/vm/nfs_test.rb @@ -160,7 +160,7 @@ class NFSVMActionTest < Test::Unit::TestCase context "mounting folders" do setup do @instance.stubs(:host_ip).returns("foo") - @instance.stubs(:folders).returns([{:guestpath => "foo"}]) + @instance.stubs(:folders).returns({ "v-data" => {:guestpath => "foo"}}) end should "mount the folders on the system" do @@ -169,8 +169,8 @@ class NFSVMActionTest < Test::Unit::TestCase end should "not mount folders which have no guest path" do - @instance.stubs(:folders).returns([{}]) - @vm.system.expects(:mount_nfs).with(@instance.host_ip, []) + @instance.stubs(:folders).returns({ "v-data" => {}}) + @vm.system.expects(:mount_nfs).with(@instance.host_ip, {}) @instance.mount_folders end end From b9e24090e9ec2875f0c3dbd61c14a37ae26e0d40 Mon Sep 17 00:00:00 2001 From: Petyo Ivanov Date: Sat, 1 Jan 2011 18:43:16 +0100 Subject: [PATCH 2/3] Add X11 ssh forwarding option (off by default). --- config/default.rb | 1 + lib/vagrant/config/ssh.rb | 1 + lib/vagrant/ssh.rb | 1 + test/vagrant/ssh_test.rb | 11 +++++++++++ 4 files changed, 14 insertions(+) diff --git a/config/default.rb b/config/default.rb index faa7f5e08..99a58a4d6 100644 --- a/config/default.rb +++ b/config/default.rb @@ -12,6 +12,7 @@ Vagrant::Config.run do |config| config.ssh.timeout = 30 config.ssh.private_key_path = File.expand_path("keys/vagrant", Vagrant.source_root) config.ssh.forward_agent = false + config.ssh.forward_x11 = false config.vm.auto_port_range = (2200..2250) config.vm.box_ovf = "box.ovf" diff --git a/lib/vagrant/config/ssh.rb b/lib/vagrant/config/ssh.rb index ca15c2cd4..de4347ce5 100644 --- a/lib/vagrant/config/ssh.rb +++ b/lib/vagrant/config/ssh.rb @@ -11,6 +11,7 @@ module Vagrant attr_accessor :timeout attr_writer :private_key_path attr_accessor :forward_agent + attr_accessor :forward_x11 def private_key_path File.expand_path(@private_key_path, env.root_path) diff --git a/lib/vagrant/ssh.rb b/lib/vagrant/ssh.rb index 8b8ce2223..16e305502 100644 --- a/lib/vagrant/ssh.rb +++ b/lib/vagrant/ssh.rb @@ -42,6 +42,7 @@ module Vagrant "-o StrictHostKeyChecking=no", "-o IdentitiesOnly=yes", "-i #{options[:private_key_path]}"] command_options << "-o ForwardAgent=yes" if env.config.ssh.forward_agent + command_options << "-o ForwardX11=yes" if env.config.ssh.forward_x11 # Some hackery going on here. On Mac OS X Leopard (10.5), exec fails # (GH-51). As a workaround, we fork and wait. On all other platforms, diff --git a/test/vagrant/ssh_test.rb b/test/vagrant/ssh_test.rb index 0acb81e62..0e96c4e1b 100644 --- a/test/vagrant/ssh_test.rb +++ b/test/vagrant/ssh_test.rb @@ -69,6 +69,17 @@ class SshTest < Test::Unit::TestCase @ssh.connect end + should "add forward X11 option if enabled" do + @env.config.ssh.forward_x11 = true + ssh_exec_expect(@ssh.port, + @env.config.ssh.private_key_path, + @env.config.ssh.username, + @env.config.ssh.host) do |args| + assert args =~ /-o ForwardX11=yes/ + end + @ssh.connect + end + context "on leopard" do setup do Vagrant::Util::Platform.stubs(:leopard?).returns(true) From 5bc2e7fb749b334a321dced91136d7be9b32538b Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 4 Jan 2011 20:18:01 -0800 Subject: [PATCH 3/3] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 213645303..cf9d3525b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Shared folders with no guest path are not automounted. [GH-184] - Boxes downloaded during `vagrant up` reload the Vagrantfile config, which fixes a problem with box settings not being properly loaded. [GH-231] + - `config.ssh.forward_x11` to enable the ForwardX11 SSH option. [GH-255] ## 0.7.0.beta (December 24, 2010)