there's been a lot of churn around this code, so i figure it was worth
trying to clean it up.
- the methods were doing a lot, so make them into template methods with
one helper per step
- spread out /etc/hosts regexp into a couple of helper variables for
clarity
- remove handling for broken hostname implementations (like basing all
of the checks on name.split('.')[0]), since it seems reasonable to
remove code dedicated only to handling broken boxes
- DRY up the shared code between debian/ubuntu implementations, which
clarifies the differences as well
- add unit tests around the behavior; this will help us in the future
to separate flaws in our understanding from flaws in implementation
- includes a new DummyCommunicator in tests which should be useful in
supporting additional unit testing of this kind
- manually tested this on squeeze, wheezy, precise, quantal, raring,
and saucy successfully.
handles the issue in #2333
33 lines
903 B
Ruby
33 lines
903 B
Ruby
require "vagrant"
|
|
|
|
module VagrantPlugins
|
|
module GuestUbuntu
|
|
class Plugin < Vagrant.plugin("2")
|
|
name "Ubuntu guest"
|
|
description "Ubuntu guest support."
|
|
|
|
guest("ubuntu", "debian") do
|
|
require File.expand_path("../guest", __FILE__)
|
|
Guest
|
|
end
|
|
|
|
guest_capability("ubuntu", "change_host_name") do
|
|
# ubuntu is just just a specialization of the debian code for this capability
|
|
require_relative "../debian/cap/change_host_name"
|
|
require_relative "cap/change_host_name"
|
|
Cap::ChangeHostName
|
|
end
|
|
|
|
guest_capability("ubuntu", "mount_nfs_folder") do
|
|
require_relative "cap/mount_nfs"
|
|
Cap::MountNFS
|
|
end
|
|
|
|
guest_capability("ubuntu", "mount_virtualbox_shared_folder") do
|
|
require_relative "cap/mount_virtualbox_shared_folder"
|
|
Cap::MountVirtualBoxSharedFolder
|
|
end
|
|
end
|
|
end
|
|
end
|