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
data/lib/vagrant/command/up.rb
CHANGED
@@ -1,16 +1,49 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
1
3
|
module Vagrant
|
2
4
|
module Command
|
3
|
-
class
|
4
|
-
class_option :provision, :type => :boolean, :default => true
|
5
|
-
register "up", "Creates the Vagrant environment"
|
6
|
-
|
5
|
+
class Up < Base
|
7
6
|
def execute
|
8
|
-
|
7
|
+
options = {
|
8
|
+
:provision => true,
|
9
|
+
:provisioners => nil
|
10
|
+
}
|
11
|
+
|
12
|
+
opts = OptionParser.new do |opts|
|
13
|
+
opts.banner = "Usage: vagrant up [vm-name] [--[no-]provision] [-h]"
|
14
|
+
|
15
|
+
opts.separator ""
|
16
|
+
|
17
|
+
opts.on("--[no-]provision", "Enable or disable provisioning") do |p|
|
18
|
+
options[:provision] = p
|
19
|
+
end
|
20
|
+
|
21
|
+
opts.on("--provision-with x,y,z", Array,
|
22
|
+
"Enable only certain provisioners, by type.") do |list|
|
23
|
+
options[:provisioners] = list
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Parse the options
|
28
|
+
argv = parse_options(opts)
|
29
|
+
return if !argv
|
30
|
+
|
31
|
+
# Parameters to send to actions
|
32
|
+
action_params = {
|
33
|
+
"provision.enabled" => options[:provision],
|
34
|
+
"provision.types" => options[:provisioners]
|
35
|
+
}
|
36
|
+
|
37
|
+
# Go over each VM and bring it up
|
38
|
+
@logger.debug("'Up' each target VM...")
|
39
|
+
with_target_vms(argv[0]) do |vm|
|
9
40
|
if vm.created?
|
10
|
-
|
11
|
-
vm.
|
41
|
+
@logger.info("Booting: #{vm.name}")
|
42
|
+
vm.ui.info I18n.t("vagrant.commands.up.vm_created")
|
43
|
+
vm.start(action_params)
|
12
44
|
else
|
13
|
-
|
45
|
+
@logger.info("Creating: #{vm.name}")
|
46
|
+
vm.up(action_params)
|
14
47
|
end
|
15
48
|
end
|
16
49
|
end
|
data/lib/vagrant/command.rb
CHANGED
@@ -1,25 +1,23 @@
|
|
1
1
|
module Vagrant
|
2
2
|
module Command
|
3
3
|
autoload :Base, 'vagrant/command/base'
|
4
|
-
|
5
|
-
autoload :
|
6
|
-
autoload :
|
4
|
+
|
5
|
+
autoload :Box, 'vagrant/command/box'
|
6
|
+
autoload :BoxAdd, 'vagrant/command/box_add'
|
7
|
+
autoload :BoxRemove, 'vagrant/command/box_remove'
|
8
|
+
autoload :BoxRepackage, 'vagrant/command/box_repackage'
|
9
|
+
autoload :BoxList, 'vagrant/command/box_list'
|
10
|
+
autoload :Destroy, 'vagrant/command/destroy'
|
11
|
+
autoload :Halt, 'vagrant/command/halt'
|
12
|
+
autoload :Init, 'vagrant/command/init'
|
13
|
+
autoload :Package, 'vagrant/command/package'
|
14
|
+
autoload :Provision, 'vagrant/command/provision'
|
15
|
+
autoload :Reload, 'vagrant/command/reload'
|
16
|
+
autoload :Resume, 'vagrant/command/resume'
|
17
|
+
autoload :SSH, 'vagrant/command/ssh'
|
18
|
+
autoload :SSHConfig, 'vagrant/command/ssh_config'
|
19
|
+
autoload :Status, 'vagrant/command/status'
|
20
|
+
autoload :Suspend, 'vagrant/command/suspend'
|
21
|
+
autoload :Up, 'vagrant/command/up'
|
7
22
|
end
|
8
23
|
end
|
9
|
-
|
10
|
-
# The built-in commands must always be loaded
|
11
|
-
require 'vagrant/command/box'
|
12
|
-
require 'vagrant/command/destroy'
|
13
|
-
require 'vagrant/command/halt'
|
14
|
-
require 'vagrant/command/init'
|
15
|
-
require 'vagrant/command/package'
|
16
|
-
require 'vagrant/command/provision'
|
17
|
-
require 'vagrant/command/reload'
|
18
|
-
require 'vagrant/command/resume'
|
19
|
-
require 'vagrant/command/ssh'
|
20
|
-
require 'vagrant/command/ssh_config'
|
21
|
-
require 'vagrant/command/status'
|
22
|
-
require 'vagrant/command/suspend'
|
23
|
-
require 'vagrant/command/up'
|
24
|
-
require 'vagrant/command/upgrade_to_060'
|
25
|
-
require 'vagrant/command/version'
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Vagrant
|
2
|
+
module Communication
|
3
|
+
# The base class for any classes that provide an API for communicating
|
4
|
+
# with the virtual machine.
|
5
|
+
#
|
6
|
+
# There are various stages that require Vagrant to copy files or
|
7
|
+
# run commands on the target system, and communication classes provide
|
8
|
+
# the abstraction necessary to perform these tasks, via SSH or some
|
9
|
+
# other mechanism.
|
10
|
+
#
|
11
|
+
# Any subclasses of this class **must** implement all of the methods
|
12
|
+
# below.
|
13
|
+
class Base
|
14
|
+
# Checks if the target machine is ready for communication.
|
15
|
+
#
|
16
|
+
# @return [Boolean]
|
17
|
+
def ready?
|
18
|
+
end
|
19
|
+
|
20
|
+
# Upload a file to the virtual machine.
|
21
|
+
#
|
22
|
+
# @param [String] from Path to a file to upload.
|
23
|
+
# @param [String] to Path to where to save this file.
|
24
|
+
def upload(from, to)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Execute a command on the remote machine.
|
28
|
+
#
|
29
|
+
# @param [String] command Command to execute.
|
30
|
+
# @yield [type, data] Realtime output of the command being executed.
|
31
|
+
# @yieldparam [String] type Type of the output, `:stdout`, `:stderr`, etc.
|
32
|
+
# @yieldparam [String] data Data for the given output.
|
33
|
+
# @return [Integer] Exit code of the command.
|
34
|
+
def execute(command, opts=nil)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Execute a comand with super user privileges.
|
38
|
+
#
|
39
|
+
# See #execute for parameter information.
|
40
|
+
def sudo(command, opts=nil)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Executes a command and returns a boolean statement if it was successful
|
44
|
+
# or not.
|
45
|
+
#
|
46
|
+
# This is implemented by default as expecting `execute` to return 0.
|
47
|
+
def test(command, opts=nil)
|
48
|
+
# Disable error checking no matter what
|
49
|
+
opts = (opts || {}).merge(:error_check => false)
|
50
|
+
|
51
|
+
# Successful if the exit status is 0
|
52
|
+
execute(command, opts) == 0
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,200 @@
|
|
1
|
+
require 'timeout'
|
2
|
+
|
3
|
+
require 'log4r'
|
4
|
+
require 'net/ssh'
|
5
|
+
require 'net/scp'
|
6
|
+
|
7
|
+
require 'vagrant/util/file_mode'
|
8
|
+
require 'vagrant/util/platform'
|
9
|
+
require 'vagrant/util/retryable'
|
10
|
+
|
11
|
+
module Vagrant
|
12
|
+
module Communication
|
13
|
+
# Provides communication with the VM via SSH.
|
14
|
+
class SSH < Base
|
15
|
+
include Util::Retryable
|
16
|
+
|
17
|
+
def initialize(vm)
|
18
|
+
@vm = vm
|
19
|
+
@logger = Log4r::Logger.new("vagrant::communication::ssh")
|
20
|
+
@connection = nil
|
21
|
+
end
|
22
|
+
|
23
|
+
def ready?
|
24
|
+
@logger.debug("Checking whether SSH is ready...")
|
25
|
+
|
26
|
+
Timeout.timeout(@vm.config.ssh.timeout) do
|
27
|
+
connect
|
28
|
+
end
|
29
|
+
|
30
|
+
# If we reached this point then we successfully connected
|
31
|
+
@logger.info("SSH is ready!")
|
32
|
+
true
|
33
|
+
rescue Timeout::Error, Errors::SSHConnectionRefused, Net::SSH::Disconnect => e
|
34
|
+
# The above errors represent various reasons that SSH may not be
|
35
|
+
# ready yet. Return false.
|
36
|
+
@logger.info("SSH not up: #{e.inspect}")
|
37
|
+
return false
|
38
|
+
end
|
39
|
+
|
40
|
+
def execute(command, opts=nil, &block)
|
41
|
+
opts = {
|
42
|
+
:error_check => true,
|
43
|
+
:error_class => Errors::VagrantError,
|
44
|
+
:error_key => :ssh_bad_exit_status,
|
45
|
+
:command => command,
|
46
|
+
:sudo => false
|
47
|
+
}.merge(opts || {})
|
48
|
+
|
49
|
+
# Connect via SSH and execute the command in the shell.
|
50
|
+
exit_status = connect do |connection|
|
51
|
+
shell_execute(connection, command, opts[:sudo], &block)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Check for any errors
|
55
|
+
if opts[:error_check] && exit_status != 0
|
56
|
+
# The error classes expect the translation key to be _key,
|
57
|
+
# but that makes for an ugly configuration parameter, so we
|
58
|
+
# set it here from `error_key`
|
59
|
+
error_opts = opts.merge(:_key => opts[:error_key])
|
60
|
+
raise opts[:error_class], error_opts
|
61
|
+
end
|
62
|
+
|
63
|
+
# Return the exit status
|
64
|
+
exit_status
|
65
|
+
end
|
66
|
+
|
67
|
+
def sudo(command, opts=nil, &block)
|
68
|
+
# Run `execute` but with the `sudo` option.
|
69
|
+
opts = { :sudo => true }.merge(opts || {})
|
70
|
+
execute(command, opts, &block)
|
71
|
+
end
|
72
|
+
|
73
|
+
def upload(from, to)
|
74
|
+
# Do an SCP-based upload...
|
75
|
+
connect do |connection|
|
76
|
+
scp = Net::SCP.new(connection)
|
77
|
+
scp.upload!(from, to)
|
78
|
+
end
|
79
|
+
rescue Net::SCP::Error => e
|
80
|
+
# If we get the exit code of 127, then this means SCP is unavailable.
|
81
|
+
raise Errors::SCPUnavailable if e.message =~ /\(127\)/
|
82
|
+
|
83
|
+
# Otherwise, just raise the error up
|
84
|
+
raise
|
85
|
+
end
|
86
|
+
|
87
|
+
protected
|
88
|
+
|
89
|
+
# Opens an SSH connection and yields it to a block.
|
90
|
+
def connect
|
91
|
+
if @connection && !@connection.closed?
|
92
|
+
# There is a chance that the socket is closed despite us checking
|
93
|
+
# 'closed?' above. To test this we need to send data through the
|
94
|
+
# socket.
|
95
|
+
begin
|
96
|
+
@connection.exec!("")
|
97
|
+
rescue IOError
|
98
|
+
@logger.info("Connection has been closed. Not re-using.")
|
99
|
+
@connection = nil
|
100
|
+
end
|
101
|
+
|
102
|
+
# If the @connection is still around, then it is valid,
|
103
|
+
# and we use it.
|
104
|
+
if @connection
|
105
|
+
@logger.info("Re-using SSH connection.")
|
106
|
+
return yield @connection if block_given?
|
107
|
+
return
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
ssh_info = @vm.ssh.info
|
112
|
+
|
113
|
+
# Build the options we'll use to initiate the connection via Net::SSH
|
114
|
+
opts = {
|
115
|
+
:port => ssh_info[:port],
|
116
|
+
:keys => [ssh_info[:private_key_path]],
|
117
|
+
:keys_only => true,
|
118
|
+
:user_known_hosts_file => [],
|
119
|
+
:paranoid => false,
|
120
|
+
:config => false,
|
121
|
+
:forward_agent => ssh_info[:forward_agent]
|
122
|
+
}
|
123
|
+
|
124
|
+
# Check that the private key permissions are valid
|
125
|
+
@vm.ssh.check_key_permissions(ssh_info[:private_key_path])
|
126
|
+
|
127
|
+
# Connect to SSH, giving it a few tries
|
128
|
+
@logger.info("Connecting to SSH: #{ssh_info[:host]}:#{ssh_info[:port]}")
|
129
|
+
exceptions = [Errno::ECONNREFUSED, Net::SSH::Disconnect]
|
130
|
+
connection = retryable(:tries => @vm.config.ssh.max_tries, :on => exceptions) do
|
131
|
+
Net::SSH.start(ssh_info[:host], ssh_info[:username], opts)
|
132
|
+
end
|
133
|
+
|
134
|
+
@connection = connection
|
135
|
+
|
136
|
+
# This is hacky but actually helps with some issues where
|
137
|
+
# Net::SSH is simply not robust enough to handle... see
|
138
|
+
# issue #391, #455, etc.
|
139
|
+
sleep 4
|
140
|
+
|
141
|
+
# Yield the connection that is ready to be used and
|
142
|
+
# return the value of the block
|
143
|
+
return yield connection if block_given?
|
144
|
+
rescue Net::SSH::AuthenticationFailed
|
145
|
+
# This happens if authentication failed. We wrap the error in our
|
146
|
+
# own exception.
|
147
|
+
raise Errors::SSHAuthenticationFailed
|
148
|
+
rescue Errno::ECONNREFUSED
|
149
|
+
# This is raised if we failed to connect the max amount of times
|
150
|
+
raise Errors::SSHConnectionRefused
|
151
|
+
ensure
|
152
|
+
# Be sure the connection is always closed
|
153
|
+
# connection.close if connection && !connection.closed?
|
154
|
+
end
|
155
|
+
|
156
|
+
# Executes the command on an SSH connection within a login shell.
|
157
|
+
def shell_execute(connection, command, sudo=false)
|
158
|
+
exit_status = nil
|
159
|
+
|
160
|
+
# Determine the shell to execute. If we are using `sudo` then we
|
161
|
+
# need to wrap the shell in a `sudo` call.
|
162
|
+
shell = "#{@vm.config.ssh.shell} -l"
|
163
|
+
shell = "sudo -H #{shell}" if sudo
|
164
|
+
|
165
|
+
# Open the channel so we can execute or command
|
166
|
+
channel = connection.open_channel do |ch|
|
167
|
+
ch.exec(shell) do |ch2, _|
|
168
|
+
# Setup the channel callbacks so we can get data and exit status
|
169
|
+
ch2.on_data do |ch3, data|
|
170
|
+
yield :stdout, data if block_given?
|
171
|
+
end
|
172
|
+
|
173
|
+
ch2.on_extended_data do |ch3, type, data|
|
174
|
+
yield :stderr, data if block_given?
|
175
|
+
end
|
176
|
+
|
177
|
+
ch2.on_request("exit-status") do |ch3, data|
|
178
|
+
exit_status = data.read_long
|
179
|
+
end
|
180
|
+
|
181
|
+
# Set the terminal
|
182
|
+
ch2.send_data "export TERM=vt100\n"
|
183
|
+
|
184
|
+
# Output the command
|
185
|
+
ch2.send_data "#{command}\n"
|
186
|
+
|
187
|
+
# Remember to exit or this channel will hang open
|
188
|
+
ch2.send_data "exit\n"
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
# Wait for the channel to complete
|
193
|
+
channel.wait
|
194
|
+
|
195
|
+
# Return the final exit status
|
196
|
+
return exit_status
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
data/lib/vagrant/config/base.rb
CHANGED
@@ -1,22 +1,9 @@
|
|
1
1
|
module Vagrant
|
2
|
-
|
2
|
+
module Config
|
3
3
|
# The base class for all configuration classes. This implements
|
4
4
|
# basic things such as the environment instance variable which all
|
5
5
|
# config classes need as well as a basic `to_json` implementation.
|
6
6
|
class Base
|
7
|
-
# {Top} of this configuration stack
|
8
|
-
attr_accessor :top
|
9
|
-
|
10
|
-
# Registers a subclass with the Vagrant configuration system so
|
11
|
-
# that it can then be used in Vagrantfiles.
|
12
|
-
#
|
13
|
-
# @param [Symbol] accessor The accessor on the main config object
|
14
|
-
# that is used to access the configuration class.
|
15
|
-
#
|
16
|
-
def self.configures(accessor, klass=self)
|
17
|
-
Top.configures(accessor, klass)
|
18
|
-
end
|
19
|
-
|
20
7
|
# Loads configuration values from JSON back into the proper
|
21
8
|
# configuration classes. By default, this is done by simply
|
22
9
|
# iterating over all values in the JSON hash and assigning them
|
@@ -29,14 +16,6 @@ module Vagrant
|
|
29
16
|
end
|
30
17
|
end
|
31
18
|
|
32
|
-
# A helper to access the environment that this configuration is for.
|
33
|
-
# This is obtained by getting the env from the {Top}.
|
34
|
-
#
|
35
|
-
# @return [Vagrant::Envrionment]
|
36
|
-
def env
|
37
|
-
top.env
|
38
|
-
end
|
39
|
-
|
40
19
|
# Allows setting options from a hash. By default this simply calls
|
41
20
|
# the `#{key}=` method on the config class with the value, which is
|
42
21
|
# the expected behavior most of the time.
|
@@ -46,12 +25,26 @@ module Vagrant
|
|
46
25
|
end
|
47
26
|
end
|
48
27
|
|
28
|
+
# Merge another configuration object into this one.
|
29
|
+
#
|
30
|
+
# @param [Object] other The other configuration object to merge from,
|
31
|
+
# this must be the same type of object as this one.
|
32
|
+
# @return [Object] The merged object.
|
33
|
+
def merge(other)
|
34
|
+
result = self.class.new
|
35
|
+
instance_variables_hash.merge(other.instance_variables_hash).each do |key, value|
|
36
|
+
result.instance_variable_set("@#{key}".to_sym, value)
|
37
|
+
end
|
38
|
+
|
39
|
+
result
|
40
|
+
end
|
41
|
+
|
49
42
|
# Called by {Top} after the configuration is loaded to validate
|
50
43
|
# the configuaration objects. Subclasses should implement this
|
51
44
|
# method and add any errors to the `errors` object given.
|
52
45
|
#
|
53
46
|
# @param [ErrorRecorder] errors
|
54
|
-
def validate(errors); end
|
47
|
+
def validate(env, errors); end
|
55
48
|
|
56
49
|
# Converts the configuration to a raw hash by calling `#to_hash`
|
57
50
|
# on all instance variables (if it can) and putting them into
|
@@ -69,14 +62,13 @@ module Vagrant
|
|
69
62
|
# the JSON is parsed back, it can be loaded back into the proper class.
|
70
63
|
# See {json_create}.
|
71
64
|
def to_json(*a)
|
72
|
-
|
73
|
-
result.merge(instance_variables_hash).to_json(*a)
|
65
|
+
instance_variables_hash.to_json(*a)
|
74
66
|
end
|
75
67
|
|
76
68
|
# Returns the instance variables as a hash of key-value pairs.
|
77
69
|
def instance_variables_hash
|
78
70
|
instance_variables.inject({}) do |acc, iv|
|
79
|
-
acc[iv.to_s[1..-1]] = instance_variable_get(iv)
|
71
|
+
acc[iv.to_s[1..-1]] = instance_variable_get(iv)
|
80
72
|
acc
|
81
73
|
end
|
82
74
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Vagrant
|
2
|
+
module Config
|
3
|
+
# Contains loaded configuration values and provides access to those
|
4
|
+
# values.
|
5
|
+
#
|
6
|
+
# This is the class returned when loading configuration and stores
|
7
|
+
# the completely loaded configuration values. This class is meant to
|
8
|
+
# be immutable.
|
9
|
+
class Container
|
10
|
+
attr_reader :global
|
11
|
+
attr_reader :vms
|
12
|
+
|
13
|
+
# Initializes the configuration container.
|
14
|
+
#
|
15
|
+
# @param [Top] global Top-level configuration for the global
|
16
|
+
# applicatoin.
|
17
|
+
# @param [Array] vms Array of VM configurations.
|
18
|
+
def initialize(global, vms)
|
19
|
+
@global = global
|
20
|
+
@vms = []
|
21
|
+
@vm_configs = {}
|
22
|
+
|
23
|
+
vms.each do |vm_config|
|
24
|
+
@vms << vm_config.vm.name
|
25
|
+
@vm_configs[vm_config.vm.name] = vm_config
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# This returns the configuration for a specific virtual machine.
|
30
|
+
# The values for this configuration are usually pertinent to a
|
31
|
+
# single virtual machine and do not affect the system globally.
|
32
|
+
def for_vm(name)
|
33
|
+
@vm_configs[name]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,125 @@
|
|
1
|
+
require "pathname"
|
2
|
+
|
3
|
+
require "log4r"
|
4
|
+
|
5
|
+
module Vagrant
|
6
|
+
module Config
|
7
|
+
# This class is responsible for loading Vagrant configuration,
|
8
|
+
# usually in the form of Vagrantfiles.
|
9
|
+
#
|
10
|
+
# Loading works by specifying the sources for the configuration
|
11
|
+
# as well as the order the sources should be loaded. Configuration
|
12
|
+
# set later always overrides those set earlier; this is how
|
13
|
+
# configuration "scoping" is implemented.
|
14
|
+
class Loader
|
15
|
+
# This is an array of symbols specifying the order in which
|
16
|
+
# configuration is loaded. For examples, see the class documentation.
|
17
|
+
attr_accessor :load_order
|
18
|
+
|
19
|
+
def initialize
|
20
|
+
@logger = Log4r::Logger.new("vagrant::config::loader")
|
21
|
+
@sources = {}
|
22
|
+
@proc_cache = {}
|
23
|
+
@config_cache = {}
|
24
|
+
end
|
25
|
+
|
26
|
+
# Set the configuration data for the given name.
|
27
|
+
#
|
28
|
+
# The `name` should be a symbol and must uniquely identify the data
|
29
|
+
# being given.
|
30
|
+
#
|
31
|
+
# `data` can either be a path to a Ruby Vagrantfile or a `Proc` directly.
|
32
|
+
# `data` can also be an array of such values.
|
33
|
+
#
|
34
|
+
# At this point, no configuration is actually loaded. Note that calling
|
35
|
+
# `set` multiple times with the same name will override any previously
|
36
|
+
# set values. In this way, the last set data for a given name wins.
|
37
|
+
def set(name, sources)
|
38
|
+
@logger.debug("Set #{name.inspect} = #{sources.inspect}")
|
39
|
+
|
40
|
+
# Sources should be an array
|
41
|
+
sources = [sources] if !sources.kind_of?(Array)
|
42
|
+
|
43
|
+
# Gather the procs for every source, since that is what we care about.
|
44
|
+
procs = []
|
45
|
+
sources.each do |source|
|
46
|
+
if !@proc_cache.has_key?(source)
|
47
|
+
# Load the procs for this source and cache them. This caching
|
48
|
+
# avoids the issue where a file may have side effects when loading
|
49
|
+
# and loading it multiple times causes unexpected behavior.
|
50
|
+
@logger.debug("Populating proc cache for #{source.inspect}")
|
51
|
+
@proc_cache[source] = procs_for_source(source)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Add on to the array of procs we're going to use
|
55
|
+
procs.concat(@proc_cache[source])
|
56
|
+
end
|
57
|
+
|
58
|
+
# Set this source by name.
|
59
|
+
@sources[name] = procs
|
60
|
+
end
|
61
|
+
|
62
|
+
# This loads the configured sources in the configured order and returns
|
63
|
+
# an actual configuration object that is ready to be used.
|
64
|
+
def load
|
65
|
+
@logger.debug("Loading configuration in order: #{@load_order.inspect}")
|
66
|
+
|
67
|
+
unknown_sources = @sources.keys - @load_order
|
68
|
+
if !unknown_sources.empty?
|
69
|
+
# TODO: Raise exception here perhaps.
|
70
|
+
@logger.error("Unknown config sources: #{unknown_sources.inspect}")
|
71
|
+
end
|
72
|
+
|
73
|
+
# Create the top-level configuration which will hold all the config.
|
74
|
+
result = Top.new
|
75
|
+
|
76
|
+
@load_order.each do |key|
|
77
|
+
next if !@sources.has_key?(key)
|
78
|
+
|
79
|
+
@sources[key].each do |proc|
|
80
|
+
if !@config_cache.has_key?(proc)
|
81
|
+
@logger.debug("Loading from: #{key} (evaluating)")
|
82
|
+
current = Top.new
|
83
|
+
proc.call(current)
|
84
|
+
@config_cache[proc] = current
|
85
|
+
end
|
86
|
+
|
87
|
+
# Merge in the results of this proc's configuration
|
88
|
+
result = result.merge(@config_cache[proc])
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
@logger.debug("Configuration loaded successfully")
|
93
|
+
result
|
94
|
+
end
|
95
|
+
|
96
|
+
protected
|
97
|
+
|
98
|
+
# This returns an array of `Proc` objects for the given source.
|
99
|
+
# The `Proc` objects returned will expect a single argument for
|
100
|
+
# the configuration object and are expected to mutate this
|
101
|
+
# configuration object.
|
102
|
+
def procs_for_source(source)
|
103
|
+
return [source] if source.is_a?(Proc)
|
104
|
+
|
105
|
+
# Assume all string sources are actually pathnames
|
106
|
+
source = Pathname.new(source) if source.is_a?(String)
|
107
|
+
|
108
|
+
if source.is_a?(Pathname)
|
109
|
+
@logger.debug("Load procs for pathname: #{source.inspect}")
|
110
|
+
|
111
|
+
begin
|
112
|
+
return Config.capture_configures do
|
113
|
+
Kernel.load source
|
114
|
+
end
|
115
|
+
rescue SyntaxError => e
|
116
|
+
# Report syntax errors in a nice way.
|
117
|
+
raise Errors::VagrantfileSyntaxError, :file => e.message
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
raise Exception, "Unknown configuration source: #{source.inspect}"
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
data/lib/vagrant/config/nfs.rb
CHANGED