Verify ubuntu/debian install for host only networking

This commit is contained in:
Mitchell Hashimoto 2010-06-03 11:35:50 -07:00
parent 2d68b284d1
commit bb7a309cab
2 changed files with 18 additions and 3 deletions

View File

@ -70,12 +70,13 @@ module Vagrant
end
def prepare_host_only_network
# TODO: Verify ubuntu here, otherwise error and tell user to
# implement this manually or to use ubuntu.
# Remove any previous host only network additions to the
# interface file.
vm.ssh.execute do |ssh|
# Verify debian/ubuntu
ssh.exec!("cat /etc/debian_version", :error_key => :network_not_debian)
# Clear out any previous entries
ssh.exec!("sudo sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/network/interfaces > /tmp/vagrant-network-interfaces")
ssh.exec!("sudo su -c 'cat /tmp/vagrant-network-interfaces > /etc/network/interfaces'")
end

View File

@ -257,3 +257,17 @@
If the box was built for 0.2.x and contains a custom public key, perhaps
the path to the private key is incorrect. Check your `config.ssh.private_key_path`.
#---------------------------------------------------------------------
# CATEGORY: Error Messages for Linux System
#---------------------------------------------------------------------
:network_not_debian: |-
Host only networking is only supported for Debian/Ubuntu by the built-in
"Linux" system. If you're using some other distro and want to implement
host only networking, please subclass the `Vagrant::Systems::Linux` class
and implement the `prepare_host_only_network` and `enable_host_only_network`
methods.
Otherwise, please report your distro and how to modify network interfaces
to the Vagrant mailing list or IRC and we'll probably be glad to add it
to the internal systems.