Pass guest IP along to the Host#nfs_export function
This commit is contained in:
parent
6887f08bf7
commit
de38af8111
|
@ -65,7 +65,7 @@ module Vagrant
|
|||
@env.logger.info "Exporting NFS shared folders..."
|
||||
|
||||
catch_action_exception(@env) do
|
||||
@env["host"].nfs_export(folders)
|
||||
@env["host"].nfs_export(guest_ip, folders)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -90,6 +90,14 @@ module Vagrant
|
|||
interface.host_interface_object.ip_address
|
||||
end
|
||||
|
||||
# Returns the IP address of the guest by looking at the first
|
||||
# enabled host only network.
|
||||
#
|
||||
# @return [String]
|
||||
def guest_ip
|
||||
@env["config"].vm.network_options[1][:ip]
|
||||
end
|
||||
|
||||
# Verifies that the host is set and supports NFS.
|
||||
def verify_settings
|
||||
return @env.error!(:nfs_host_required) if @env["host"].nil?
|
||||
|
|
|
@ -63,8 +63,9 @@ module Vagrant
|
|||
# Exports the given hash of folders via NFS. This method will raise
|
||||
# an {Vagrant::Action::ActionException} if anything goes wrong.
|
||||
#
|
||||
# @param [String] ip IP of the guest machine.
|
||||
# @param [Hash] folders Shared folders to sync.
|
||||
def nfs_export(folders)
|
||||
def nfs_export(ip, folders)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -96,10 +96,11 @@ class NFSVMActionTest < Test::Unit::TestCase
|
|||
context "exporting folders" do
|
||||
setup do
|
||||
@instance.stubs(:folders).returns({})
|
||||
@instance.stubs(:guest_ip).returns("192.168.33.10")
|
||||
end
|
||||
|
||||
should "call nfs_export on the host" do
|
||||
@env["host"].expects(:nfs_export).with(@instance.folders)
|
||||
@env["host"].expects(:nfs_export).with(@instance.guest_ip, @instance.folders)
|
||||
@instance.export_folders
|
||||
end
|
||||
|
||||
|
@ -151,6 +152,15 @@ class NFSVMActionTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
context "getting the guest IP" do
|
||||
should "return the first networked IP" do
|
||||
ip = "192.168.33.10"
|
||||
@env.env.config.vm.network(ip, :adapter => 1)
|
||||
@env.env.config.vm.network("192.168.66.10", :adapter => 2)
|
||||
assert_equal ip, @instance.guest_ip
|
||||
end
|
||||
end
|
||||
|
||||
context "verifying settings" do
|
||||
setup do
|
||||
@env.env.host.stubs(:nfs?).returns(true)
|
||||
|
|
|
@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|||
|
||||
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
||||
s.authors = ["Mitchell Hashimoto", "John Bender"]
|
||||
s.date = %q{2010-07-11}
|
||||
s.date = %q{2010-07-12}
|
||||
s.default_executable = %q{vagrant}
|
||||
s.description = %q{Vagrant is a tool for building and distributing virtualized development environments.}
|
||||
s.email = ["mitchell.hashimoto@gmail.com", "john.m.bender@gmail.com"]
|
||||
|
|
Loading…
Reference in New Issue