diff --git a/config/default.rb b/config/default.rb index c9eadce3b..46fd4eef6 100644 --- a/config/default.rb +++ b/config/default.rb @@ -5,7 +5,6 @@ Vagrant::Config.run do |config| config.vagrant.home = "~/.vagrant" config.ssh.username = "vagrant" - config.ssh.password = "vagrant" config.ssh.host = "localhost" config.ssh.port = 22 config.ssh.forwarded_port_key = "ssh" @@ -16,8 +15,6 @@ Vagrant::Config.run do |config| config.vm.auto_port_range = (2200..2250) config.vm.box_ovf = "box.ovf" config.vm.base_mac = "0800279C2E42" - config.vm.project_directory = "/vagrant" - config.vm.rsync_project_directory = false config.vm.forward_port("ssh", 22, 2222, :auto => true) config.vm.disk_image_format = 'VMDK' config.vm.provisioner = nil @@ -26,6 +23,10 @@ Vagrant::Config.run do |config| config.vm.boot_mode = "vrdp" config.vm.system = :linux + # Share the root folder. This can then be overridden by + # other Vagrantfiles, if they wish. + config.vm.share_folder("v-root", "/vagrant", ".") + # TODO new config class config.vm.rsync_opts = "-ur --delete" config.vm.rsync_script = "/tmp/rsync" diff --git a/lib/vagrant/actions/vm/boot.rb b/lib/vagrant/actions/vm/boot.rb index 9d840c079..a60a1c268 100644 --- a/lib/vagrant/actions/vm/boot.rb +++ b/lib/vagrant/actions/vm/boot.rb @@ -2,13 +2,6 @@ module Vagrant module Actions module VM class Boot < Base - def prepare - @runner.env.config.vm.share_folder("v-root", - @runner.env.config.vm.project_directory, - @runner.env.root_path, - :rsync => @runner.env.config.vm.rsync_project_directory) - end - def execute! @runner.invoke_around_callback(:boot) do # Startup the VM diff --git a/lib/vagrant/actions/vm/shared_folders.rb b/lib/vagrant/actions/vm/shared_folders.rb index 23c47f35d..a10e6202a 100644 --- a/lib/vagrant/actions/vm/shared_folders.rb +++ b/lib/vagrant/actions/vm/shared_folders.rb @@ -5,7 +5,7 @@ module Vagrant def shared_folders @runner.env.config.vm.shared_folders.inject([]) do |acc, data| name, value = data - acc << [name, File.expand_path(value[:hostpath]), value[:guestpath], value[:rsyncpath]].compact + acc << [name, File.expand_path(value[:hostpath], @runner.env.root_path), value[:guestpath], value[:rsyncpath]].compact end end diff --git a/lib/vagrant/config.rb b/lib/vagrant/config.rb index 08721c297..d2685f7b1 100644 --- a/lib/vagrant/config.rb +++ b/lib/vagrant/config.rb @@ -61,7 +61,6 @@ module Vagrant class SSHConfig < Base attr_accessor :username - attr_accessor :password attr_accessor :host attr_accessor :port attr_accessor :forwarded_port_key @@ -69,6 +68,10 @@ module Vagrant attr_accessor :timeout attr_accessor :private_key_path + # The attribute(s) below do nothing. They are just kept here to + # prevent syntax errors for backwards compat. + attr_accessor :password + def private_key_path File.expand_path(@private_key_path, env.root_path) end @@ -82,8 +85,6 @@ module Vagrant attr_accessor :box_ovf attr_accessor :base_mac attr_accessor :boot_mode - attr_accessor :project_directory - attr_accessor :rsync_project_directory attr_accessor :rsync_opts attr_accessor :rsync_script attr_accessor :rsync_crontab_entry_file diff --git a/lib/vagrant/provisioners/chef.rb b/lib/vagrant/provisioners/chef.rb index e3be29492..2b958c329 100644 --- a/lib/vagrant/provisioners/chef.rb +++ b/lib/vagrant/provisioners/chef.rb @@ -106,7 +106,7 @@ module Vagrant # Set up initial configuration data = { :config => env.config, - :directory => env.config.vm.project_directory, + :directory => env.config.vm.shared_folders["v-root"][:guestpath], } # And wrap it under the "vagrant" namespace diff --git a/test/test_helper.rb b/test/test_helper.rb index da09636b3..074ea8b3c 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -27,7 +27,6 @@ class Test::Unit::TestCase config.vagrant.log_output = nil config.ssh.username = "foo" - config.ssh.password = "bar" config.ssh.host = "baz" config.ssh.port = 22 config.ssh.forwarded_port_key = "ssh" @@ -38,8 +37,6 @@ class Test::Unit::TestCase config.vm.box = "foo" config.vm.box_ovf = "box.ovf" config.vm.base_mac = "42" - config.vm.project_directory = "/vagrant" - config.vm.rsync_project_directory = false config.vm.disk_image_format = 'VMDK' config.vm.forward_port("ssh", 22, 2222) config.vm.shared_folder_uid = nil @@ -47,6 +44,7 @@ class Test::Unit::TestCase config.vm.system = :linux config.vm.rsync_script = "/foo" config.vm.rsync_crontab_entry_file = "/tmp/foo" + config.vm.share_folder("v-root", "/vagrant", ".") config.package.name = 'vagrant' config.package.extension = '.box' diff --git a/test/vagrant/actions/vm/boot_test.rb b/test/vagrant/actions/vm/boot_test.rb index 19ca5dba0..ab7069370 100644 --- a/test/vagrant/actions/vm/boot_test.rb +++ b/test/vagrant/actions/vm/boot_test.rb @@ -6,16 +6,6 @@ class BootActionTest < Test::Unit::TestCase @runner.stubs(:invoke_callback) end - context "preparing" do - should "add the root shared folder" do - @runner.env.config.vm.expects(:share_folder).with("v-root", - @runner.env.config.vm.project_directory, - @runner.env.root_path, - :rsync => @runner.env.config.vm.rsync_project_directory).once - @action.prepare - end - end - context "execution" do should "invoke the 'boot' around callback" do boot_seq = sequence("boot_seq") diff --git a/test/vagrant/actions/vm/shared_folders_test.rb b/test/vagrant/actions/vm/shared_folders_test.rb index e30a09a77..c66520663 100644 --- a/test/vagrant/actions/vm/shared_folders_test.rb +++ b/test/vagrant/actions/vm/shared_folders_test.rb @@ -34,7 +34,7 @@ class SharedFoldersActionTest < Test::Unit::TestCase end should "expand the path of the host folder" do - File.expects(:expand_path).with("baz").once.returns("expanded_baz") + File.expects(:expand_path).with("baz", @runner.env.root_path).once.returns("expanded_baz") env = mock_environment do |config| config.vm.shared_folders.clear diff --git a/test/vagrant/provisioners/chef_test.rb b/test/vagrant/provisioners/chef_test.rb index 2b6d9af28..bf9ca1768 100644 --- a/test/vagrant/provisioners/chef_test.rb +++ b/test/vagrant/provisioners/chef_test.rb @@ -155,13 +155,13 @@ class ChefProvisionerTest < Test::Unit::TestCase should "add the directory as a special case to the JSON" do assert_json do |data| - assert_equal @env.config.vm.project_directory, data["vagrant"]["directory"] + assert_equal @env.config.vm.shared_folders["v-root"][:guestpath], data["vagrant"]["directory"] end end should "add the config to the JSON" do assert_json do |data| - assert_equal @env.config.vm.project_directory, data["vagrant"]["config"]["vm"]["project_directory"] + assert_equal @env.config.ssh.username, data["vagrant"]["config"]["ssh"]["username"] end end