Raise an error message if host only networking is not supported

This commit is contained in:
Mitchell Hashimoto 2011-01-09 13:34:37 -08:00
parent 0828fb9199
commit 766607db49
3 changed files with 36 additions and 1 deletions

View File

@ -15,6 +15,10 @@ module Vagrant
# required by systems can and will change at any time. Any
# changes will be noted on release notes.**
class Base
class BaseError < Errors::VagrantError
error_namespace("vagrant.systems.base")
end
include Vagrant::Util
# The VM which this system is tied to.
@ -64,7 +68,9 @@ module Vagrant
# Prepares the system for host only networks. This is called
# once prior to any `enable_host_only_network` calls.
def prepare_host_only_network; end
def prepare_host_only_network
raise BaseError, :_key => :unsupported_host_only
end
# Setup the system by adding a new host only network. This
# method should configure and bring up the interface for the

View File

@ -460,6 +460,16 @@ en:
running_puppetd: "Running Puppet agent..."
systems:
base:
unsupported_host_only: |-
Host only networking is very distro-specific. Vagrant has support for many
distros built-in: Debian, Ubuntu, Gentoo, and RedHat. The distro of your VM
couldn't be detected, or isn't supported for host only networking.
Most of the time this is simply due to the fact that no one has contributed
back the SSH commands necessary to set this up. Please report a bug and this
will be fixed for your distro.
linux:
attempting_halt: "Attempting graceful shutdown of linux..."
mount_fail: "Failed to mount shared folders. `vboxsf` was not available."
@ -469,5 +479,6 @@ en:
that the NFS client software is properly installed, and consult any resources
specific to the linux distro you're using for more information on how to
do this.
solaris:
attempting_halt: "Attempting graceful shutdown of solaris..."

View File

@ -0,0 +1,18 @@
require "test_helper"
class BaseSystemTest < Test::Unit::TestCase
setup do
@klass = Vagrant::Systems::Base
@vm = mock("vm")
@instance = @klass.new(@vm)
end
should "provide access to the VM" do
assert_equal @vm, @instance.vm
end
should "error on preparing host only network" do
assert_raises(@klass::BaseError) { @instance.prepare_host_only_network }
end
end