vagrantup 0.8.10 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +77 -1
- data/Gemfile +0 -14
- data/LICENSE +1 -1
- data/bin/vagrant +47 -20
- data/config/default.rb +6 -14
- data/lib/vagrant/action/box/destroy.rb +7 -3
- data/lib/vagrant/action/box/download.rb +8 -8
- data/lib/vagrant/action/box/package.rb +2 -2
- data/lib/vagrant/action/box/unpackage.rb +13 -7
- data/lib/vagrant/action/box/verify.rb +5 -5
- data/lib/vagrant/action/builder.rb +23 -19
- data/lib/vagrant/action/builtin.rb +117 -79
- data/lib/vagrant/action/env/set.rb +7 -4
- data/lib/vagrant/action/environment.rb +3 -41
- data/lib/vagrant/action/general/package.rb +14 -29
- data/lib/vagrant/action/general/validate.rb +2 -2
- data/lib/vagrant/action/runner.rb +53 -0
- data/lib/vagrant/action/vm/boot.rb +9 -9
- data/lib/vagrant/action/vm/check_accessible.rb +2 -2
- data/lib/vagrant/action/vm/check_box.rb +10 -12
- data/lib/vagrant/action/vm/check_guest_additions.rb +8 -8
- data/lib/vagrant/action/vm/check_port_collisions.rb +85 -0
- data/lib/vagrant/action/vm/clean_machine_folder.rb +4 -4
- data/lib/vagrant/action/vm/clear_forwarded_ports.rb +3 -11
- data/lib/vagrant/action/vm/clear_network_interfaces.rb +31 -0
- data/lib/vagrant/action/vm/clear_shared_folders.rb +2 -11
- data/lib/vagrant/action/vm/customize.rb +19 -9
- data/lib/vagrant/action/vm/destroy.rb +4 -4
- data/lib/vagrant/action/vm/destroy_unused_network_interfaces.rb +2 -12
- data/lib/vagrant/action/vm/discard_state.rb +4 -4
- data/lib/vagrant/action/vm/export.rb +13 -8
- data/lib/vagrant/action/vm/forward_ports.rb +55 -102
- data/lib/vagrant/action/vm/halt.rb +9 -6
- data/lib/vagrant/action/vm/host_name.rb +4 -4
- data/lib/vagrant/action/vm/import.rb +19 -10
- data/lib/vagrant/action/vm/match_mac_address.rb +4 -9
- data/lib/vagrant/action/vm/network.rb +300 -94
- data/lib/vagrant/action/vm/nfs.rb +41 -26
- data/lib/vagrant/action/vm/package.rb +1 -1
- data/lib/vagrant/action/vm/package_vagrantfile.rb +5 -2
- data/lib/vagrant/action/vm/provision.rb +42 -13
- data/lib/vagrant/action/vm/provisioner_cleanup.rb +2 -2
- data/lib/vagrant/action/vm/{clear_nfs_exports.rb → prune_nfs_exports.rb} +7 -7
- data/lib/vagrant/action/vm/resume.rb +4 -4
- data/lib/vagrant/action/vm/setup_package_files.rb +54 -0
- data/lib/vagrant/action/vm/share_folders.rb +63 -39
- data/lib/vagrant/action/vm/suspend.rb +4 -4
- data/lib/vagrant/action/warden.rb +13 -6
- data/lib/vagrant/action.rb +45 -123
- data/lib/vagrant/box.rb +9 -55
- data/lib/vagrant/box_collection.rb +22 -17
- data/lib/vagrant/cli.rb +62 -47
- data/lib/vagrant/command/base.rb +135 -90
- data/lib/vagrant/command/box.rb +46 -21
- data/lib/vagrant/command/box_add.rb +33 -0
- data/lib/vagrant/command/box_list.rb +25 -0
- data/lib/vagrant/command/box_remove.rb +23 -0
- data/lib/vagrant/command/box_repackage.rb +23 -0
- data/lib/vagrant/command/destroy.rb +16 -5
- data/lib/vagrant/command/halt.rb +25 -7
- data/lib/vagrant/command/init.rb +30 -7
- data/lib/vagrant/command/package.rb +49 -18
- data/lib/vagrant/command/provision.rb +22 -9
- data/lib/vagrant/command/reload.rb +18 -5
- data/lib/vagrant/command/resume.rb +18 -5
- data/lib/vagrant/command/ssh.rb +69 -31
- data/lib/vagrant/command/ssh_config.rb +37 -22
- data/lib/vagrant/command/status.rb +22 -20
- data/lib/vagrant/command/suspend.rb +18 -5
- data/lib/vagrant/command/up.rb +41 -8
- data/lib/vagrant/command.rb +18 -20
- data/lib/vagrant/communication/base.rb +56 -0
- data/lib/vagrant/communication/ssh.rb +200 -0
- data/lib/vagrant/communication.rb +7 -0
- data/lib/vagrant/config/base.rb +18 -26
- data/lib/vagrant/config/container.rb +37 -0
- data/lib/vagrant/config/error_recorder.rb +1 -1
- data/lib/vagrant/config/loader.rb +125 -0
- data/lib/vagrant/config/nfs.rb +1 -3
- data/lib/vagrant/config/package.rb +1 -3
- data/lib/vagrant/config/ssh.rb +31 -16
- data/lib/vagrant/config/top.rb +36 -25
- data/lib/vagrant/config/vagrant.rb +2 -5
- data/lib/vagrant/config/vm/provisioner.rb +16 -20
- data/lib/vagrant/config/vm/sub_vm.rb +1 -1
- data/lib/vagrant/config/vm.rb +115 -56
- data/lib/vagrant/config.rb +29 -103
- data/lib/vagrant/data_store.rb +23 -15
- data/lib/vagrant/downloaders/base.rb +7 -5
- data/lib/vagrant/downloaders/file.rb +4 -4
- data/lib/vagrant/downloaders/http.rb +4 -5
- data/lib/vagrant/driver/virtualbox.rb +121 -0
- data/lib/vagrant/driver/virtualbox_4_0.rb +411 -0
- data/lib/vagrant/driver/virtualbox_4_1.rb +411 -0
- data/lib/vagrant/driver/virtualbox_base.rb +284 -0
- data/lib/vagrant/driver.rb +7 -0
- data/lib/vagrant/environment.rb +221 -240
- data/lib/vagrant/errors.rb +74 -25
- data/lib/vagrant/guest/arch.rb +48 -0
- data/lib/vagrant/{systems → guest}/base.rb +30 -18
- data/lib/vagrant/guest/debian.rb +61 -0
- data/lib/vagrant/{systems → guest}/freebsd.rb +11 -18
- data/lib/vagrant/guest/gentoo.rb +32 -0
- data/lib/vagrant/{systems → guest}/linux/config.rb +2 -4
- data/lib/vagrant/guest/linux/error.rb +9 -0
- data/lib/vagrant/guest/linux.rb +78 -0
- data/lib/vagrant/guest/redhat.rb +66 -0
- data/lib/vagrant/guest/solaris.rb +114 -0
- data/lib/vagrant/{systems → guest}/suse.rb +2 -2
- data/lib/vagrant/guest/ubuntu.rb +23 -0
- data/lib/vagrant/guest.rb +16 -0
- data/lib/vagrant/hosts/arch.rb +7 -3
- data/lib/vagrant/hosts/base.rb +36 -46
- data/lib/vagrant/hosts/bsd.rb +53 -16
- data/lib/vagrant/hosts/fedora.rb +14 -0
- data/lib/vagrant/hosts/freebsd.rb +6 -36
- data/lib/vagrant/hosts/linux.rb +45 -20
- data/lib/vagrant/hosts/windows.rb +16 -0
- data/lib/vagrant/hosts.rb +23 -6
- data/lib/vagrant/provisioners/base.rb +11 -34
- data/lib/vagrant/provisioners/chef.rb +30 -26
- data/lib/vagrant/provisioners/chef_client.rb +37 -23
- data/lib/vagrant/provisioners/chef_solo.rb +61 -16
- data/lib/vagrant/provisioners/puppet.rb +70 -38
- data/lib/vagrant/provisioners/puppet_server.rb +12 -13
- data/lib/vagrant/provisioners/shell.rb +24 -24
- data/lib/vagrant/provisioners.rb +10 -7
- data/lib/vagrant/registry.rb +49 -0
- data/lib/vagrant/ssh.rb +82 -153
- data/lib/vagrant/ui.rb +118 -50
- data/lib/vagrant/util/busy.rb +1 -1
- data/lib/vagrant/util/file_mode.rb +12 -0
- data/lib/vagrant/util/network_ip.rb +28 -0
- data/lib/vagrant/util/platform.rb +1 -0
- data/lib/vagrant/util/subprocess.rb +227 -0
- data/lib/vagrant/version.rb +1 -1
- data/lib/vagrant/vm.rb +111 -97
- data/lib/vagrant.rb +132 -5
- data/tasks/acceptance.rake +3 -3
- data/tasks/test.rake +7 -2
- data/templates/commands/init/Vagrantfile.erb +11 -4
- data/templates/{ssh_config.erb → commands/ssh_config/config.erb} +0 -0
- data/templates/guests/arch/network_dhcp.erb +7 -0
- data/templates/guests/arch/network_static.erb +7 -0
- data/templates/guests/debian/network_dhcp.erb +6 -0
- data/templates/guests/debian/network_static.erb +7 -0
- data/templates/guests/gentoo/network_dhcp.erb +4 -0
- data/templates/guests/gentoo/network_static.erb +4 -0
- data/templates/guests/redhat/network_dhcp.erb +6 -0
- data/templates/guests/redhat/network_static.erb +7 -0
- data/templates/locales/en.yml +241 -122
- data/templates/{chef_server_client.erb → provisioners/chef_client/client.erb} +0 -0
- data/templates/{chef_solo_solo.erb → provisioners/chef_solo/solo.erb} +0 -0
- data/test/acceptance/base.rb +10 -10
- data/test/acceptance/box_test.rb +28 -6
- data/test/acceptance/destroy_test.rb +1 -1
- data/test/acceptance/halt_test.rb +4 -4
- data/test/acceptance/init_test.rb +3 -3
- data/test/acceptance/networking/host_only_test.rb +37 -0
- data/test/acceptance/networking/port_forward_test.rb +125 -0
- data/test/acceptance/package_test.rb +46 -0
- data/test/acceptance/provisioning/basic_test.rb +61 -0
- data/test/acceptance/provisioning/chef_solo_test.rb +37 -0
- data/test/acceptance/provisioning/shell_test.rb +53 -0
- data/test/acceptance/resume_test.rb +1 -1
- data/test/acceptance/skeletons/chef_solo_basic/README.md +3 -0
- data/test/acceptance/skeletons/chef_solo_basic/cookbooks/basic/recipes/default.rb +5 -0
- data/test/acceptance/skeletons/chef_solo_json/README.md +3 -0
- data/test/acceptance/skeletons/chef_solo_json/cookbooks/basic/recipes/default.rb +6 -0
- data/test/acceptance/skeletons/provisioner_multi/README.md +3 -0
- data/test/acceptance/skeletons/provisioner_multi/cookbooks/basic/recipes/default.rb +5 -0
- data/test/acceptance/ssh_test.rb +7 -2
- data/test/acceptance/support/config.rb +1 -1
- data/test/acceptance/support/isolated_environment.rb +41 -150
- data/test/acceptance/support/matchers/match_output.rb +1 -1
- data/test/acceptance/support/matchers/succeed.rb +14 -0
- data/test/acceptance/support/network_tests.rb +29 -0
- data/test/acceptance/support/output.rb +9 -1
- data/test/acceptance/support/shared/base_context.rb +16 -9
- data/test/acceptance/support/shared/command_examples.rb +4 -4
- data/test/acceptance/suspend_test.rb +1 -1
- data/test/acceptance/up_basic_test.rb +26 -7
- data/test/acceptance/up_with_box_url.rb +1 -1
- data/test/acceptance/vagrant_test.rb +1 -1
- data/test/acceptance/version_test.rb +0 -5
- data/test/support/isolated_environment.rb +46 -0
- data/test/{acceptance/support → support}/tempdir.rb +0 -0
- data/test/unit/base.rb +21 -0
- data/test/unit/support/isolated_environment.rb +39 -0
- data/test/unit/support/shared/base_context.rb +30 -0
- data/test/unit/vagrant/action/builder_test.rb +126 -177
- data/test/unit/vagrant/action/environment_test.rb +10 -21
- data/test/unit/vagrant/action/runner_test.rb +65 -0
- data/test/unit/vagrant/action/warden_test.rb +64 -97
- data/test/unit/vagrant/box_collection_test.rb +44 -33
- data/test/unit/vagrant/box_test.rb +25 -65
- data/test/unit/vagrant/command/base_test.rb +141 -14
- data/test/unit/vagrant/config/base_test.rb +16 -43
- data/test/unit/vagrant/config/loader_test.rb +79 -0
- data/test/unit/vagrant/config/top_test.rb +69 -0
- data/test/unit/vagrant/config/vm_test.rb +62 -47
- data/test/unit/vagrant/config_test.rb +16 -151
- data/test/unit/vagrant/data_store_test.rb +43 -61
- data/test/unit/vagrant/downloaders/base_test.rb +12 -22
- data/test/unit/vagrant/downloaders/file_test.rb +58 -31
- data/test/unit/vagrant/downloaders/http_test.rb +12 -86
- data/test/unit/vagrant/environment_test.rb +107 -536
- data/test/unit/vagrant/hosts_test.rb +36 -0
- data/test/unit/vagrant/registry_test.rb +56 -0
- data/test/unit/vagrant/util/file_checksum_test.rb +23 -0
- data/test/unit/vagrant/util/hash_with_indifferent_access_test.rb +23 -24
- data/test/unit/vagrant/util/network_ip_test.rb +17 -0
- data/test/unit/vagrant/util/retryable_test.rb +90 -34
- data/test/unit/vagrant_test.rb +27 -0
- data/test/{unit → unit_legacy}/locales/en.yml +0 -0
- data/test/{unit → unit_legacy}/test_helper.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/box/destroy_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/box/download_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/box/package_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/box/unpackage_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/box/verify_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/env/set_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/general/package_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/general/validate_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/boot_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/check_accessible_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/check_box_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/check_guest_additions_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/clean_machine_folder_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/clear_forwarded_ports_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/clear_nfs_exports_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/clear_shared_folders_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/customize_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/destroy_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/destroy_unused_network_interfaces_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/discard_state_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/export_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/forward_ports_helpers_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/forward_ports_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/halt_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/host_name_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/import_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/match_mac_address_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/modify_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/network_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/nfs_helpers_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/nfs_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/package_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/package_vagrantfile_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/provision_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/provisioner_cleanup_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/resume_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/share_folders_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/suspend_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action_test.rb +0 -0
- data/test/unit_legacy/vagrant/box_collection_test.rb +45 -0
- data/test/unit_legacy/vagrant/box_test.rb +74 -0
- data/test/{unit → unit_legacy}/vagrant/cli_test.rb +0 -0
- data/test/unit_legacy/vagrant/command/base_test.rb +23 -0
- data/test/{unit → unit_legacy}/vagrant/command/group_base_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/command/helpers_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/command/init_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/command/package_test.rb +0 -0
- data/test/unit_legacy/vagrant/config/base_test.rb +52 -0
- data/test/{unit → unit_legacy}/vagrant/config/error_recorder_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/config/ssh_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/config/vagrant_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/config/vm/provisioner_test.rb +0 -0
- data/test/unit_legacy/vagrant/config/vm_test.rb +47 -0
- data/test/unit_legacy/vagrant/config_test.rb +148 -0
- data/test/unit_legacy/vagrant/downloaders/http_test.rb +93 -0
- data/test/unit_legacy/vagrant/environment_test.rb +539 -0
- data/test/{unit → unit_legacy}/vagrant/errors_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/hosts/base_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/hosts/bsd_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/hosts/linux_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/plugin_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/base_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/chef_client_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/chef_solo_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/chef_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/puppet_server_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/puppet_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/shell_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/ssh/session_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/ssh_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/systems/base_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/systems/linux_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/util/busy_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/util/counter_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/util/platform_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/util/stacked_proc_runner_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/util/template_renderer_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/vm_test.rb +0 -0
- data/vagrant.gemspec +7 -9
- metadata +183 -179
- data/keys/vagrant.ppk +0 -26
- data/lib/vagrant/action/box.rb +0 -11
- data/lib/vagrant/action/env.rb +0 -7
- data/lib/vagrant/action/general.rb +0 -8
- data/lib/vagrant/action/vm/forward_ports_helpers.rb +0 -28
- data/lib/vagrant/action/vm/modify.rb +0 -37
- data/lib/vagrant/action/vm/nfs_helpers.rb +0 -11
- data/lib/vagrant/action/vm.rb +0 -34
- data/lib/vagrant/command/group_base.rb +0 -107
- data/lib/vagrant/command/helpers.rb +0 -33
- data/lib/vagrant/command/named_base.rb +0 -14
- data/lib/vagrant/command/upgrade_to_060.rb +0 -45
- data/lib/vagrant/command/version.rb +0 -13
- data/lib/vagrant/ssh/session.rb +0 -136
- data/lib/vagrant/systems/arch.rb +0 -34
- data/lib/vagrant/systems/debian.rb +0 -36
- data/lib/vagrant/systems/gentoo.rb +0 -27
- data/lib/vagrant/systems/linux/error.rb +0 -9
- data/lib/vagrant/systems/linux.rb +0 -82
- data/lib/vagrant/systems/redhat.rb +0 -48
- data/lib/vagrant/systems/solaris.rb +0 -113
- data/lib/vagrant/systems/ubuntu.rb +0 -17
- data/lib/vagrant/systems.rb +0 -13
- data/templates/network_entry_arch.erb +0 -9
- data/templates/network_entry_debian.erb +0 -8
- data/templates/network_entry_gentoo.erb +0 -5
- data/templates/network_entry_redhat.erb +0 -9
- data/test/unit/vagrant/ui_test.rb +0 -29
@@ -0,0 +1,114 @@
|
|
1
|
+
module Vagrant
|
2
|
+
module Guest
|
3
|
+
# A general Vagrant system implementation for "solaris".
|
4
|
+
#
|
5
|
+
# Contributed by Blake Irvin <b.irvin@modcloth.com>
|
6
|
+
class Solaris < Base
|
7
|
+
# A custom config class which will be made accessible via `config.solaris`
|
8
|
+
# This is not necessary for all system implementers, of course. However,
|
9
|
+
# generally, Vagrant tries to make almost every aspect of its execution
|
10
|
+
# configurable, and this assists that goal.
|
11
|
+
class SolarisConfig < Vagrant::Config::Base
|
12
|
+
attr_accessor :halt_timeout
|
13
|
+
attr_accessor :halt_check_interval
|
14
|
+
# This sets the command to use to execute items as a superuser. sudo is default
|
15
|
+
attr_accessor :suexec_cmd
|
16
|
+
attr_accessor :device
|
17
|
+
|
18
|
+
def initialize
|
19
|
+
@halt_timeout = 30
|
20
|
+
@halt_check_interval = 1
|
21
|
+
@suexec_cmd = 'sudo'
|
22
|
+
@device = "e1000g"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# Here for whenever it may be used.
|
27
|
+
class SolarisError < Errors::VagrantError
|
28
|
+
error_namespace("vagrant.guest.solaris")
|
29
|
+
end
|
30
|
+
|
31
|
+
def configure_networks(networks)
|
32
|
+
networks.each do |network|
|
33
|
+
device = "#{vm.config.solaris.device}#{network[:interface]}"
|
34
|
+
su_cmd = vm.config.solaris.suexec_cmd
|
35
|
+
ifconfig_cmd = "#{su_cmd} /sbin/ifconfig #{device}"
|
36
|
+
|
37
|
+
vm.channel.execute("#{ifconfig_cmd} plumb")
|
38
|
+
|
39
|
+
if network[:type].to_sym == :static
|
40
|
+
vm.channel.execute("#{ifconfig_cmd} inet #{network[:ip]} netmask #{network[:netmask]}")
|
41
|
+
vm.channel.execute("#{ifconfig_cmd} up")
|
42
|
+
vm.channel.execute("#{su_cmd} sh -c \"echo '#{network[:ip]}' > /etc/hostname.#{device}\"")
|
43
|
+
elsif network[:type].to_sym == :dhcp
|
44
|
+
vm.channel.execute("#{ifconfig_cmd} dhcp start")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def change_host_name(name)
|
50
|
+
su_cmd = vm.config.solaris.suexec_cmd
|
51
|
+
|
52
|
+
# Only do this if the hostname is not already set
|
53
|
+
if !vm.channel.test("#{su_cmd} hostname | grep '#{name}'")
|
54
|
+
vm.channel.execute("#{su_cmd} sh -c \"echo '#{name}' > /etc/nodename\"")
|
55
|
+
vm.channel.execute("#{su_cmd} uname -S #{name}")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# There should be an exception raised if the line
|
60
|
+
#
|
61
|
+
# vagrant::::profiles=Primary Administrator
|
62
|
+
#
|
63
|
+
# does not exist in /etc/user_attr. TODO
|
64
|
+
def halt
|
65
|
+
# Wait until the VM's state is actually powered off. If this doesn't
|
66
|
+
# occur within a reasonable amount of time (15 seconds by default),
|
67
|
+
# then simply return and allow Vagrant to kill the machine.
|
68
|
+
count = 0
|
69
|
+
last_error = nil
|
70
|
+
while vm.state != :poweroff
|
71
|
+
begin
|
72
|
+
vm.channel.execute("#{vm.config.solaris.suexec_cmd} /usr/sbin/poweroff")
|
73
|
+
rescue IOError => e
|
74
|
+
# Save the last error; if it's not shutdown in a reasonable amount
|
75
|
+
# of attempts we will re-raise the error so it's not hidden for
|
76
|
+
# all time
|
77
|
+
last_error = e
|
78
|
+
end
|
79
|
+
|
80
|
+
count += 1
|
81
|
+
if count >= vm.config.solaris.halt_timeout
|
82
|
+
# Check for last error and re-raise it
|
83
|
+
if last_error != nil
|
84
|
+
raise last_error
|
85
|
+
else
|
86
|
+
# Otherwise, just return
|
87
|
+
return
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# Still opportunities remaining; sleep and loop
|
92
|
+
sleep vm.config.solaris.halt_check_interval
|
93
|
+
end # while
|
94
|
+
end
|
95
|
+
|
96
|
+
def mount_shared_folder(name, guestpath, options)
|
97
|
+
# These are just far easier to use than the full options syntax
|
98
|
+
owner = options[:owner]
|
99
|
+
group = options[:group]
|
100
|
+
|
101
|
+
# Create the shared folder
|
102
|
+
vm.channel.execute("#{vm.config.solaris.suexec_cmd} mkdir -p #{guestpath}")
|
103
|
+
|
104
|
+
# Mount the folder with the proper owner/group
|
105
|
+
mount_options = "-o uid=`id -u #{owner}`,gid=`id -g #{group}`"
|
106
|
+
mount_options += ",#{options[:extra]}" if options[:extra]
|
107
|
+
vm.channel.execute("#{vm.config.solaris.suexec_cmd} /sbin/mount -F vboxfs #{mount_options} #{name} #{guestpath}")
|
108
|
+
|
109
|
+
# chown the folder to the proper owner/group
|
110
|
+
vm.channel.execute("#{vm.config.solaris.suexec_cmd} chown `id -u #{owner}`:`id -g #{group}` #{guestpath}")
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'vagrant/guest/debian'
|
2
|
+
|
3
|
+
module Vagrant
|
4
|
+
module Guest
|
5
|
+
class Ubuntu < Debian
|
6
|
+
def mount_shared_folder(name, guestpath, options)
|
7
|
+
# Mount it like normal
|
8
|
+
super
|
9
|
+
|
10
|
+
# Emit an upstart event if upstart is available
|
11
|
+
@vm.channel.sudo("[ -x /sbin/initctl ] && /sbin/initctl emit vagrant-mounted MOUNTPOINT=#{guestpath}")
|
12
|
+
end
|
13
|
+
|
14
|
+
def change_host_name(name)
|
15
|
+
if !vm.channel.test("sudo hostname | grep '#{name}'")
|
16
|
+
vm.channel.sudo("sed -i 's/.*$/#{name}/' /etc/hostname")
|
17
|
+
vm.channel.sudo("sed -i 's@^\\(127[.]0[.]1[.]1[[:space:]]\\+\\)@\\1#{name} #{name.split('.')[0]} @' /etc/hosts")
|
18
|
+
vm.channel.sudo("service hostname start")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Vagrant
|
2
|
+
module Guest
|
3
|
+
autoload :Base, 'vagrant/guest/base'
|
4
|
+
|
5
|
+
# Specific guests
|
6
|
+
autoload :Arch, 'vagrant/guest/arch'
|
7
|
+
autoload :Debian, 'vagrant/guest/debian'
|
8
|
+
autoload :FreeBSD, 'vagrant/guest/freebsd'
|
9
|
+
autoload :Gentoo, 'vagrant/guest/gentoo'
|
10
|
+
autoload :Linux, 'vagrant/guest/linux'
|
11
|
+
autoload :Redhat, 'vagrant/guest/redhat'
|
12
|
+
autoload :Solaris, 'vagrant/guest/solaris'
|
13
|
+
autoload :Suse, 'vagrant/guest/suse'
|
14
|
+
autoload :Ubuntu, 'vagrant/guest/ubuntu'
|
15
|
+
end
|
16
|
+
end
|
data/lib/vagrant/hosts/arch.rb
CHANGED
@@ -1,13 +1,17 @@
|
|
1
1
|
module Vagrant
|
2
2
|
module Hosts
|
3
3
|
class Arch < Linux
|
4
|
-
def
|
4
|
+
def self.match?
|
5
|
+
File.exist?("/etc/rc.conf") && File.exist?("/etc/pacman.conf")
|
6
|
+
end
|
7
|
+
|
8
|
+
def nfs_export(id, ip, folders)
|
5
9
|
output = TemplateRenderer.render('nfs/exports_linux',
|
6
|
-
:uuid =>
|
10
|
+
:uuid => id,
|
7
11
|
:ip => ip,
|
8
12
|
:folders => folders)
|
9
13
|
|
10
|
-
|
14
|
+
@ui.info I18n.t("vagrant.hosts.arch.nfs_export.prepare")
|
11
15
|
sleep 0.5
|
12
16
|
|
13
17
|
output.split("\n").each do |line|
|
data/lib/vagrant/hosts/base.rb
CHANGED
@@ -1,54 +1,39 @@
|
|
1
1
|
module Vagrant
|
2
2
|
module Hosts
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
# default
|
3
|
+
# Interface for classes which house behavior that is specific
|
4
|
+
# to the host OS that is running Vagrant.
|
5
|
+
#
|
6
|
+
# By default, Vagrant will attempt to choose the best option
|
7
|
+
# for your machine, but the host may also be explicitly set
|
8
|
+
# via the `config.vagrant.host` parameter.
|
7
9
|
class Base
|
8
|
-
#
|
9
|
-
|
10
|
-
|
11
|
-
# Loads the proper host for the given value. If the value is nil
|
12
|
-
# or is the symbol `:detect`, then the host class will be detected
|
13
|
-
# using the `RUBY_PLATFORM` constant.
|
14
|
-
#
|
15
|
-
# @param [Environment] env
|
16
|
-
# @param [String] klass
|
17
|
-
# @return [Base]
|
18
|
-
def self.load(env, klass)
|
19
|
-
klass = detect if klass.nil? || klass == :detect
|
20
|
-
return nil if !klass
|
21
|
-
return klass.new(env)
|
22
|
-
end
|
23
|
-
|
24
|
-
# Detects the proper host class for current platform and returns
|
25
|
-
# the class.
|
10
|
+
# This returns true/false depending on if the current running system
|
11
|
+
# matches the host class.
|
26
12
|
#
|
27
|
-
# @return [
|
28
|
-
def self.
|
29
|
-
[BSD, Linux].each do |type|
|
30
|
-
result = type.distro_dispatch
|
31
|
-
return result if result
|
32
|
-
end
|
33
|
-
|
34
|
-
nil
|
35
|
-
rescue Exception
|
13
|
+
# @return [Boolean]
|
14
|
+
def self.match?
|
36
15
|
nil
|
37
16
|
end
|
38
17
|
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
|
43
|
-
|
18
|
+
# The precedence of the host when checking for matches. This is to
|
19
|
+
# allow certain host such as generic OS's ("Linux", "BSD", etc.)
|
20
|
+
# to be specified last.
|
21
|
+
#
|
22
|
+
# The hosts with the higher numbers will be checked first.
|
23
|
+
#
|
24
|
+
# If you're implementing a basic host, you can probably ignore this.
|
25
|
+
def self.precedence
|
26
|
+
5
|
44
27
|
end
|
45
28
|
|
46
|
-
#
|
47
|
-
#
|
29
|
+
# Initializes a new host class.
|
30
|
+
#
|
31
|
+
# The only required parameter is a UI object so that the host
|
32
|
+
# objects have some way to communicate with the outside world.
|
48
33
|
#
|
49
|
-
# @param [
|
50
|
-
def initialize(
|
51
|
-
@
|
34
|
+
# @param [UI] ui UI for the hosts to output to.
|
35
|
+
def initialize(ui)
|
36
|
+
@ui = ui
|
52
37
|
end
|
53
38
|
|
54
39
|
# Returns true of false denoting whether or not this host supports
|
@@ -60,16 +45,21 @@ module Vagrant
|
|
60
45
|
false
|
61
46
|
end
|
62
47
|
|
63
|
-
# Exports the given hash of folders via NFS.
|
64
|
-
# an {Vagrant::Action::ActionException} if anything goes wrong.
|
48
|
+
# Exports the given hash of folders via NFS.
|
65
49
|
#
|
50
|
+
# @param [String] id A unique ID that is guaranteed to be unique to
|
51
|
+
# match these sets of folders.
|
66
52
|
# @param [String] ip IP of the guest machine.
|
67
53
|
# @param [Hash] folders Shared folders to sync.
|
68
|
-
def nfs_export(ip, folders)
|
54
|
+
def nfs_export(id, ip, folders)
|
69
55
|
end
|
70
56
|
|
71
|
-
#
|
72
|
-
|
57
|
+
# Prunes any NFS exports made by Vagrant which aren't in the set
|
58
|
+
# of valid ids given.
|
59
|
+
#
|
60
|
+
# @param [Array<String>] valid_ids Valid IDs that should not be
|
61
|
+
# pruned.
|
62
|
+
def nfs_prune(valid_ids)
|
73
63
|
end
|
74
64
|
end
|
75
65
|
end
|
data/lib/vagrant/hosts/bsd.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'log4r'
|
2
|
+
|
1
3
|
require 'vagrant/util/platform'
|
2
4
|
|
3
5
|
module Vagrant
|
@@ -7,9 +9,21 @@ module Vagrant
|
|
7
9
|
include Util
|
8
10
|
include Util::Retryable
|
9
11
|
|
10
|
-
def self.
|
11
|
-
|
12
|
-
|
12
|
+
def self.match?
|
13
|
+
Util::Platform.darwin? || Util::Platform.bsd?
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.precedence
|
17
|
+
# Set a lower precedence because this is a generic OS. We
|
18
|
+
# want specific distros to match first.
|
19
|
+
2
|
20
|
+
end
|
21
|
+
|
22
|
+
def initialize(*args)
|
23
|
+
super
|
24
|
+
|
25
|
+
@logger = Log4r::Logger.new("vagrant::hosts::bsd")
|
26
|
+
@nfs_restart_command = "sudo nfsd restart"
|
13
27
|
end
|
14
28
|
|
15
29
|
def nfs?
|
@@ -18,42 +32,65 @@ module Vagrant
|
|
18
32
|
end
|
19
33
|
end
|
20
34
|
|
21
|
-
def nfs_export(ip, folders)
|
35
|
+
def nfs_export(id, ip, folders)
|
22
36
|
output = TemplateRenderer.render('nfs/exports',
|
23
|
-
:uuid =>
|
37
|
+
:uuid => id,
|
24
38
|
:ip => ip,
|
25
39
|
:folders => folders)
|
26
40
|
|
27
41
|
# The sleep ensures that the output is truly flushed before any `sudo`
|
28
42
|
# commands are issued.
|
29
|
-
|
43
|
+
@ui.info I18n.t("vagrant.hosts.bsd.nfs_export")
|
30
44
|
sleep 0.5
|
31
45
|
|
46
|
+
# First, clean up the old entry
|
47
|
+
nfs_cleanup(id)
|
48
|
+
|
49
|
+
# Output the rendered template into the exports
|
32
50
|
output.split("\n").each do |line|
|
33
|
-
# This should only ask for administrative permission once, even
|
34
|
-
# though its executed in multiple subshells.
|
35
51
|
line = line.gsub('"', '\"')
|
36
52
|
system(%Q[sudo su root -c "echo '#{line}' >> /etc/exports"])
|
37
53
|
end
|
38
54
|
|
39
55
|
# We run restart here instead of "update" just in case nfsd
|
40
56
|
# is not starting
|
41
|
-
system(
|
57
|
+
system(@nfs_restart_command)
|
42
58
|
end
|
43
59
|
|
44
|
-
def
|
60
|
+
def nfs_prune(valid_ids)
|
45
61
|
return if !File.exist?("/etc/exports")
|
46
62
|
|
47
|
-
|
48
|
-
system("cat /etc/exports | grep 'VAGRANT-BEGIN: #{env.vm.uuid}' > /dev/null 2>&1")
|
63
|
+
@logger.info("Pruning invalid NFS entries...")
|
49
64
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
65
|
+
output = false
|
66
|
+
|
67
|
+
File.read("/etc/exports").lines.each do |line|
|
68
|
+
if line =~ /^# VAGRANT-BEGIN: (.+?)$/
|
69
|
+
if valid_ids.include?($1.to_s)
|
70
|
+
@logger.debug("Valid ID: #{$1.to_s}")
|
71
|
+
else
|
72
|
+
if !output
|
73
|
+
# We want to warn the user but we only want to output once
|
74
|
+
@ui.info I18n.t("vagrant.hosts.bsd.nfs_prune")
|
75
|
+
output = true
|
76
|
+
end
|
77
|
+
|
78
|
+
@logger.info("Invalid ID, pruning: #{$1.to_s}")
|
79
|
+
nfs_cleanup($1.to_s)
|
80
|
+
end
|
54
81
|
end
|
55
82
|
end
|
56
83
|
end
|
84
|
+
|
85
|
+
protected
|
86
|
+
|
87
|
+
def nfs_cleanup(id)
|
88
|
+
return if !File.exist?("/etc/exports")
|
89
|
+
|
90
|
+
# Use sed to just strip out the block of code which was inserted
|
91
|
+
# by Vagrant, and restart NFS.
|
92
|
+
system("sudo sed -e '/^# VAGRANT-BEGIN: #{id}/,/^# VAGRANT-END: #{id}/ d' -ibak /etc/exports")
|
93
|
+
end
|
57
94
|
end
|
58
95
|
end
|
59
96
|
end
|
data/lib/vagrant/hosts/fedora.rb
CHANGED
@@ -1,6 +1,20 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
1
3
|
module Vagrant
|
2
4
|
module Hosts
|
3
5
|
class Fedora < Linux
|
6
|
+
def self.match?
|
7
|
+
release_file = Pathname.new("/etc/redhat-release")
|
8
|
+
|
9
|
+
if release_file.exist?
|
10
|
+
release_file.open("r") do |f|
|
11
|
+
return true if f.gets =~ /^Fedora/
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
false
|
16
|
+
end
|
17
|
+
|
4
18
|
def initialize(*args)
|
5
19
|
super
|
6
20
|
|
@@ -7,45 +7,15 @@ module Vagrant
|
|
7
7
|
include Util
|
8
8
|
include Util::Retryable
|
9
9
|
|
10
|
-
def
|
11
|
-
|
12
|
-
:uuid => env.vm.uuid,
|
13
|
-
:ip => ip,
|
14
|
-
:folders => folders)
|
15
|
-
|
16
|
-
# The sleep ensures that the output is truly flushed before any `sudo`
|
17
|
-
# commands are issued.
|
18
|
-
env.ui.info I18n.t("vagrant.hosts.bsd.nfs_export.prepare")
|
19
|
-
sleep 0.5
|
20
|
-
|
21
|
-
output.split("\n").each do |line|
|
22
|
-
# This should only ask for administrative permission once, even
|
23
|
-
# though its executed in multiple subshells.
|
24
|
-
line = line.gsub('"', '\"')
|
25
|
-
system(%Q[sudo su root -c "echo '#{line}' >> /etc/exports"])
|
26
|
-
end
|
27
|
-
|
28
|
-
# We run restart here instead of "update" just in case nfsd
|
29
|
-
# is not starting
|
30
|
-
system("sudo /etc/rc.d/mountd onereload")
|
10
|
+
def self.match?
|
11
|
+
Util::Platform.freebsd?
|
31
12
|
end
|
32
13
|
|
33
|
-
|
34
|
-
|
35
|
-
def nfs_cleanup
|
36
|
-
return if !File.exist?("/etc/exports")
|
37
|
-
|
38
|
-
retryable(:tries => 10, :on => TypeError) do
|
39
|
-
system("cat /etc/exports | grep 'VAGRANT-BEGIN: #{env.vm.uuid}' > /dev/null 2>&1")
|
14
|
+
def initialize(*args)
|
15
|
+
super
|
40
16
|
|
41
|
-
|
42
|
-
# Use sed to just strip out the block of code which was inserted
|
43
|
-
# by Vagrant
|
44
|
-
system("sudo sed -e '/^# VAGRANT-BEGIN: #{env.vm.uuid}/,/^# VAGRANT-END: #{env.vm.uuid}/ d' -ibak /etc/exports")
|
45
|
-
end
|
46
|
-
|
47
|
-
system("sudo /etc/rc.d/mountd onereload")
|
48
|
-
end
|
17
|
+
@nfs_restart_command = "sudo /etc/rc.d/mountd onereload"
|
49
18
|
end
|
19
|
+
end
|
50
20
|
end
|
51
21
|
end
|
data/lib/vagrant/hosts/linux.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'log4r'
|
2
|
+
|
1
3
|
require 'vagrant/util/platform'
|
2
4
|
|
3
5
|
module Vagrant
|
@@ -7,23 +9,20 @@ module Vagrant
|
|
7
9
|
include Util
|
8
10
|
include Util::Retryable
|
9
11
|
|
10
|
-
def self.
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
if File.exist?("/etc/redhat-release")
|
15
|
-
# Check if we have a known redhat release
|
16
|
-
File.open("/etc/redhat-release") do |f|
|
17
|
-
return Fedora if f.gets =~ /^Fedora/
|
18
|
-
end
|
19
|
-
end
|
12
|
+
def self.match?
|
13
|
+
Util::Platform.linux?
|
14
|
+
end
|
20
15
|
|
21
|
-
|
16
|
+
def self.precedence
|
17
|
+
# Set a lower precedence because this is a generic OS. We
|
18
|
+
# want specific distros to match first.
|
19
|
+
2
|
22
20
|
end
|
23
21
|
|
24
22
|
def initialize(*args)
|
25
23
|
super
|
26
24
|
|
25
|
+
@logger = Log4r::Logger.new("vagrant::hosts::linux")
|
27
26
|
@nfs_server_binary = "/etc/init.d/nfs-kernel-server"
|
28
27
|
end
|
29
28
|
|
@@ -34,15 +33,17 @@ module Vagrant
|
|
34
33
|
end
|
35
34
|
end
|
36
35
|
|
37
|
-
def nfs_export(ip, folders)
|
36
|
+
def nfs_export(id, ip, folders)
|
38
37
|
output = TemplateRenderer.render('nfs/exports_linux',
|
39
|
-
:uuid =>
|
38
|
+
:uuid => id,
|
40
39
|
:ip => ip,
|
41
40
|
:folders => folders)
|
42
41
|
|
43
|
-
|
42
|
+
@ui.info I18n.t("vagrant.hosts.linux.nfs_export")
|
44
43
|
sleep 0.5
|
45
44
|
|
45
|
+
nfs_cleanup(id)
|
46
|
+
|
46
47
|
output.split("\n").each do |line|
|
47
48
|
# This should only ask for administrative permission once, even
|
48
49
|
# though its executed in multiple subshells.
|
@@ -54,16 +55,40 @@ module Vagrant
|
|
54
55
|
system("sudo #{@nfs_server_binary} restart")
|
55
56
|
end
|
56
57
|
|
57
|
-
def
|
58
|
+
def nfs_prune(valid_ids)
|
58
59
|
return if !File.exist?("/etc/exports")
|
59
|
-
system("cat /etc/exports | grep 'VAGRANT-BEGIN: #{env.vm.uuid}' > /dev/null 2>&1")
|
60
60
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
61
|
+
@logger.info("Pruning invalid NFS entries...")
|
62
|
+
|
63
|
+
output = false
|
64
|
+
|
65
|
+
File.read("/etc/exports").lines.each do |line|
|
66
|
+
if line =~ /^# VAGRANT-BEGIN: (.+?)$/
|
67
|
+
if valid_ids.include?($1.to_s)
|
68
|
+
@logger.debug("Valid ID: #{$1.to_s}")
|
69
|
+
else
|
70
|
+
if !output
|
71
|
+
# We want to warn the user but we only want to output once
|
72
|
+
@ui.info I18n.t("vagrant.hosts.linux.nfs_prune")
|
73
|
+
output = true
|
74
|
+
end
|
75
|
+
|
76
|
+
@logger.info("Invalid ID, pruning: #{$1.to_s}")
|
77
|
+
nfs_cleanup($1.to_s)
|
78
|
+
end
|
79
|
+
end
|
65
80
|
end
|
66
81
|
end
|
82
|
+
|
83
|
+
protected
|
84
|
+
|
85
|
+
def nfs_cleanup(id)
|
86
|
+
return if !File.exist?("/etc/exports")
|
87
|
+
|
88
|
+
# Use sed to just strip out the block of code which was inserted
|
89
|
+
# by Vagrant
|
90
|
+
system("sudo sed -e '/^# VAGRANT-BEGIN: #{id}/,/^# VAGRANT-END: #{id}/ d' -ibak /etc/exports")
|
91
|
+
end
|
67
92
|
end
|
68
93
|
end
|
69
94
|
end
|
data/lib/vagrant/hosts.rb
CHANGED
@@ -1,10 +1,27 @@
|
|
1
1
|
module Vagrant
|
2
2
|
module Hosts
|
3
|
-
autoload :Base,
|
4
|
-
autoload :Arch,
|
5
|
-
autoload :BSD,
|
6
|
-
autoload :FreeBSD,'vagrant/hosts/freebsd'
|
7
|
-
autoload :Fedora,
|
8
|
-
autoload :Linux,
|
3
|
+
autoload :Base, 'vagrant/hosts/base'
|
4
|
+
autoload :Arch, 'vagrant/hosts/arch'
|
5
|
+
autoload :BSD, 'vagrant/hosts/bsd'
|
6
|
+
autoload :FreeBSD, 'vagrant/hosts/freebsd'
|
7
|
+
autoload :Fedora, 'vagrant/hosts/fedora'
|
8
|
+
autoload :Linux, 'vagrant/hosts/linux'
|
9
|
+
autoload :Windows, 'vagrant/hosts/windows'
|
10
|
+
|
11
|
+
# This method detects the correct host based on the `match?` methods
|
12
|
+
# implemented in the registered hosts.
|
13
|
+
def self.detect(registry)
|
14
|
+
# Sort the hosts by their precedence
|
15
|
+
host_klasses = registry.to_hash.values
|
16
|
+
host_klasses = host_klasses.sort_by { |a| a.precedence }.reverse
|
17
|
+
|
18
|
+
# Test for matches and return the host class that matches
|
19
|
+
host_klasses.each do |klass|
|
20
|
+
return klass if klass.match?
|
21
|
+
end
|
22
|
+
|
23
|
+
# No matches found...
|
24
|
+
return nil
|
25
|
+
end
|
9
26
|
end
|
10
27
|
end
|