vagrant 1.0.7 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -43
- data/Gemfile +2 -1
- data/LICENSE.txt +22 -0
- data/README.md +3 -90
- data/Rakefile +1 -18
- data/bin/vagrant +2 -58
- data/message.txt +17 -0
- data/vagrant.gemspec +20 -69
- metadata +43 -655
- data/.yardopts +0 -1
- data/CHANGELOG.md +0 -723
- data/LICENSE +0 -21
- data/config/default.rb +0 -30
- data/contrib/README.md +0 -12
- data/contrib/emacs/vagrant.el +0 -8
- data/contrib/vim/vagrantfile.vim +0 -9
- data/keys/README.md +0 -17
- data/keys/vagrant +0 -27
- data/keys/vagrant.pub +0 -1
- data/lib/vagrant.rb +0 -197
- data/lib/vagrant/action.rb +0 -63
- data/lib/vagrant/action/box/destroy.rb +0 -25
- data/lib/vagrant/action/box/download.rb +0 -84
- data/lib/vagrant/action/box/package.rb +0 -19
- data/lib/vagrant/action/box/unpackage.rb +0 -61
- data/lib/vagrant/action/box/verify.rb +0 -23
- data/lib/vagrant/action/builder.rb +0 -128
- data/lib/vagrant/action/builtin.rb +0 -171
- data/lib/vagrant/action/env/set.rb +0 -21
- data/lib/vagrant/action/environment.rb +0 -12
- data/lib/vagrant/action/general/check_virtualbox.rb +0 -28
- data/lib/vagrant/action/general/package.rb +0 -101
- data/lib/vagrant/action/general/validate.rb +0 -18
- data/lib/vagrant/action/runner.rb +0 -53
- data/lib/vagrant/action/vm/boot.rb +0 -53
- data/lib/vagrant/action/vm/check_accessible.rb +0 -23
- data/lib/vagrant/action/vm/check_box.rb +0 -33
- data/lib/vagrant/action/vm/check_guest_additions.rb +0 -38
- data/lib/vagrant/action/vm/check_port_collisions.rb +0 -89
- data/lib/vagrant/action/vm/clean_machine_folder.rb +0 -43
- data/lib/vagrant/action/vm/clear_forwarded_ports.rb +0 -18
- data/lib/vagrant/action/vm/clear_network_interfaces.rb +0 -31
- data/lib/vagrant/action/vm/clear_shared_folders.rb +0 -18
- data/lib/vagrant/action/vm/customize.rb +0 -36
- data/lib/vagrant/action/vm/default_name.rb +0 -22
- data/lib/vagrant/action/vm/destroy.rb +0 -19
- data/lib/vagrant/action/vm/destroy_unused_network_interfaces.rb +0 -20
- data/lib/vagrant/action/vm/discard_state.rb +0 -22
- data/lib/vagrant/action/vm/export.rb +0 -57
- data/lib/vagrant/action/vm/forward_ports.rb +0 -92
- data/lib/vagrant/action/vm/halt.rb +0 -32
- data/lib/vagrant/action/vm/host_name.rb +0 -21
- data/lib/vagrant/action/vm/import.rb +0 -48
- data/lib/vagrant/action/vm/match_mac_address.rb +0 -21
- data/lib/vagrant/action/vm/network.rb +0 -403
- data/lib/vagrant/action/vm/nfs.rb +0 -196
- data/lib/vagrant/action/vm/package.rb +0 -23
- data/lib/vagrant/action/vm/package_vagrantfile.rb +0 -36
- data/lib/vagrant/action/vm/provision.rb +0 -61
- data/lib/vagrant/action/vm/provisioner_cleanup.rb +0 -26
- data/lib/vagrant/action/vm/prune_nfs_exports.rb +0 -20
- data/lib/vagrant/action/vm/resume.rb +0 -20
- data/lib/vagrant/action/vm/sane_defaults.rb +0 -78
- data/lib/vagrant/action/vm/setup_package_files.rb +0 -54
- data/lib/vagrant/action/vm/share_folders.rb +0 -114
- data/lib/vagrant/action/vm/suspend.rb +0 -20
- data/lib/vagrant/action/warden.rb +0 -92
- data/lib/vagrant/box.rb +0 -44
- data/lib/vagrant/box_collection.rb +0 -58
- data/lib/vagrant/cli.rb +0 -76
- data/lib/vagrant/command.rb +0 -24
- data/lib/vagrant/command/base.rb +0 -167
- data/lib/vagrant/command/box.rb +0 -58
- data/lib/vagrant/command/box_add.rb +0 -37
- data/lib/vagrant/command/box_list.rb +0 -28
- data/lib/vagrant/command/box_remove.rb +0 -27
- data/lib/vagrant/command/box_repackage.rb +0 -27
- data/lib/vagrant/command/destroy.rb +0 -64
- data/lib/vagrant/command/gem.rb +0 -39
- data/lib/vagrant/command/halt.rb +0 -39
- data/lib/vagrant/command/init.rb +0 -40
- data/lib/vagrant/command/package.rb +0 -75
- data/lib/vagrant/command/provision.rb +0 -40
- data/lib/vagrant/command/reload.rb +0 -39
- data/lib/vagrant/command/resume.rb +0 -33
- data/lib/vagrant/command/ssh.rb +0 -90
- data/lib/vagrant/command/ssh_config.rb +0 -51
- data/lib/vagrant/command/start_mixins.rb +0 -26
- data/lib/vagrant/command/status.rb +0 -36
- data/lib/vagrant/command/suspend.rb +0 -33
- data/lib/vagrant/command/up.rb +0 -40
- data/lib/vagrant/communication.rb +0 -7
- data/lib/vagrant/communication/base.rb +0 -56
- data/lib/vagrant/communication/ssh.rb +0 -230
- data/lib/vagrant/config.rb +0 -49
- data/lib/vagrant/config/base.rb +0 -82
- data/lib/vagrant/config/container.rb +0 -37
- data/lib/vagrant/config/error_recorder.rb +0 -19
- data/lib/vagrant/config/loader.rb +0 -127
- data/lib/vagrant/config/nfs.rb +0 -8
- data/lib/vagrant/config/package.rb +0 -7
- data/lib/vagrant/config/ssh.rb +0 -27
- data/lib/vagrant/config/top.rb +0 -72
- data/lib/vagrant/config/vagrant.rb +0 -14
- data/lib/vagrant/config/vm.rb +0 -168
- data/lib/vagrant/config/vm/provisioner.rb +0 -52
- data/lib/vagrant/config/vm/sub_vm.rb +0 -17
- data/lib/vagrant/data_store.rb +0 -92
- data/lib/vagrant/downloaders.rb +0 -7
- data/lib/vagrant/downloaders/base.rb +0 -25
- data/lib/vagrant/downloaders/file.rb +0 -22
- data/lib/vagrant/downloaders/http.rb +0 -97
- data/lib/vagrant/driver.rb +0 -8
- data/lib/vagrant/driver/virtualbox.rb +0 -134
- data/lib/vagrant/driver/virtualbox_4_0.rb +0 -459
- data/lib/vagrant/driver/virtualbox_4_1.rb +0 -459
- data/lib/vagrant/driver/virtualbox_4_2.rb +0 -606
- data/lib/vagrant/driver/virtualbox_base.rb +0 -326
- data/lib/vagrant/environment.rb +0 -522
- data/lib/vagrant/errors.rb +0 -445
- data/lib/vagrant/guest.rb +0 -18
- data/lib/vagrant/guest/arch.rb +0 -56
- data/lib/vagrant/guest/base.rb +0 -99
- data/lib/vagrant/guest/debian.rb +0 -64
- data/lib/vagrant/guest/fedora.rb +0 -66
- data/lib/vagrant/guest/freebsd.rb +0 -86
- data/lib/vagrant/guest/gentoo.rb +0 -46
- data/lib/vagrant/guest/linux.rb +0 -118
- data/lib/vagrant/guest/linux/config.rb +0 -19
- data/lib/vagrant/guest/linux/error.rb +0 -9
- data/lib/vagrant/guest/openbsd.rb +0 -20
- data/lib/vagrant/guest/redhat.rb +0 -67
- data/lib/vagrant/guest/solaris.rb +0 -118
- data/lib/vagrant/guest/suse.rb +0 -17
- data/lib/vagrant/guest/ubuntu.rb +0 -23
- data/lib/vagrant/hosts.rb +0 -37
- data/lib/vagrant/hosts/arch.rb +0 -55
- data/lib/vagrant/hosts/base.rb +0 -66
- data/lib/vagrant/hosts/bsd.rb +0 -97
- data/lib/vagrant/hosts/fedora.rb +0 -47
- data/lib/vagrant/hosts/freebsd.rb +0 -41
- data/lib/vagrant/hosts/gentoo.rb +0 -20
- data/lib/vagrant/hosts/linux.rb +0 -94
- data/lib/vagrant/hosts/opensuse.rb +0 -30
- data/lib/vagrant/hosts/windows.rb +0 -16
- data/lib/vagrant/plugin.rb +0 -81
- data/lib/vagrant/provisioners.rb +0 -12
- data/lib/vagrant/provisioners/base.rb +0 -44
- data/lib/vagrant/provisioners/chef.rb +0 -168
- data/lib/vagrant/provisioners/chef_client.rb +0 -132
- data/lib/vagrant/provisioners/chef_solo.rb +0 -234
- data/lib/vagrant/provisioners/puppet.rb +0 -176
- data/lib/vagrant/provisioners/puppet_server.rb +0 -78
- data/lib/vagrant/provisioners/shell.rb +0 -103
- data/lib/vagrant/registry.rb +0 -52
- data/lib/vagrant/ssh.rb +0 -126
- data/lib/vagrant/test_helpers.rb +0 -154
- data/lib/vagrant/ui.rb +0 -168
- data/lib/vagrant/util.rb +0 -12
- data/lib/vagrant/util/ansi_escape_code_remover.rb +0 -34
- data/lib/vagrant/util/busy.rb +0 -59
- data/lib/vagrant/util/counter.rb +0 -24
- data/lib/vagrant/util/file_checksum.rb +0 -38
- data/lib/vagrant/util/file_mode.rb +0 -12
- data/lib/vagrant/util/hash_with_indifferent_access.rb +0 -63
- data/lib/vagrant/util/is_port_open.rb +0 -38
- data/lib/vagrant/util/line_ending_helpers.rb +0 -14
- data/lib/vagrant/util/network_ip.rb +0 -28
- data/lib/vagrant/util/platform.rb +0 -68
- data/lib/vagrant/util/retryable.rb +0 -25
- data/lib/vagrant/util/safe_exec.rb +0 -36
- data/lib/vagrant/util/safe_puts.rb +0 -31
- data/lib/vagrant/util/stacked_proc_runner.rb +0 -35
- data/lib/vagrant/util/subprocess.rb +0 -247
- data/lib/vagrant/util/template_renderer.rb +0 -83
- data/lib/vagrant/version.rb +0 -6
- data/lib/vagrant/vm.rb +0 -195
- data/tasks/acceptance.rake +0 -113
- data/tasks/bundler.rake +0 -3
- data/tasks/test.rake +0 -20
- data/templates/commands/init/Vagrantfile.erb +0 -99
- data/templates/commands/ssh_config/config.erb +0 -15
- data/templates/config/validation_failed.erb +0 -7
- data/templates/guests/arch/network_dhcp.erb +0 -7
- data/templates/guests/arch/network_static.erb +0 -7
- data/templates/guests/debian/network_dhcp.erb +0 -6
- data/templates/guests/debian/network_static.erb +0 -7
- data/templates/guests/fedora/network_dhcp.erb +0 -6
- data/templates/guests/fedora/network_static.erb +0 -13
- data/templates/guests/freebsd/network_dhcp.erb +0 -3
- data/templates/guests/freebsd/network_static.erb +0 -3
- data/templates/guests/gentoo/network_dhcp.erb +0 -4
- data/templates/guests/gentoo/network_static.erb +0 -4
- data/templates/guests/redhat/network_dhcp.erb +0 -6
- data/templates/guests/redhat/network_static.erb +0 -7
- data/templates/locales/en.yml +0 -759
- data/templates/nfs/exports.erb +0 -5
- data/templates/nfs/exports_freebsd.erb +0 -5
- data/templates/nfs/exports_linux.erb +0 -5
- data/templates/package_Vagrantfile.erb +0 -11
- data/templates/provisioners/chef_client/client.erb +0 -32
- data/templates/provisioners/chef_solo/solo.erb +0 -25
- data/test/acceptance/base.rb +0 -48
- data/test/acceptance/box_test.rb +0 -99
- data/test/acceptance/destroy_test.rb +0 -37
- data/test/acceptance/halt_test.rb +0 -72
- data/test/acceptance/init_test.rb +0 -33
- data/test/acceptance/networking/host_only_test.rb +0 -37
- data/test/acceptance/networking/port_forward_test.rb +0 -125
- data/test/acceptance/package_test.rb +0 -46
- data/test/acceptance/provisioning/basic_test.rb +0 -61
- data/test/acceptance/provisioning/chef_solo_test.rb +0 -37
- data/test/acceptance/provisioning/shell_test.rb +0 -53
- data/test/acceptance/resume_test.rb +0 -17
- data/test/acceptance/shared_folders_test.rb +0 -84
- data/test/acceptance/skeletons/chef_solo_basic/README.md +0 -3
- data/test/acceptance/skeletons/chef_solo_basic/cookbooks/basic/recipes/default.rb +0 -5
- data/test/acceptance/skeletons/chef_solo_json/README.md +0 -3
- data/test/acceptance/skeletons/chef_solo_json/cookbooks/basic/recipes/default.rb +0 -6
- data/test/acceptance/skeletons/provisioner_multi/README.md +0 -3
- data/test/acceptance/skeletons/provisioner_multi/cookbooks/basic/recipes/default.rb +0 -5
- data/test/acceptance/ssh_test.rb +0 -46
- data/test/acceptance/support/config.rb +0 -42
- data/test/acceptance/support/isolated_environment.rb +0 -117
- data/test/acceptance/support/matchers/have_color.rb +0 -9
- data/test/acceptance/support/matchers/match_output.rb +0 -14
- data/test/acceptance/support/matchers/succeed.rb +0 -14
- data/test/acceptance/support/network_tests.rb +0 -29
- data/test/acceptance/support/output.rb +0 -95
- data/test/acceptance/support/shared/base_context.rb +0 -72
- data/test/acceptance/support/shared/command_examples.rb +0 -33
- data/test/acceptance/support/virtualbox.rb +0 -36
- data/test/acceptance/suspend_test.rb +0 -56
- data/test/acceptance/up_basic_test.rb +0 -33
- data/test/acceptance/up_with_box_url.rb +0 -40
- data/test/acceptance/vagrant_test.rb +0 -47
- data/test/acceptance/version_test.rb +0 -15
- data/test/buildbot/README.md +0 -72
- data/test/buildbot/buildbot_config/__init__.py +0 -0
- data/test/buildbot/buildbot_config/config/__init__.py +0 -0
- data/test/buildbot/buildbot_config/config/loader.py +0 -24
- data/test/buildbot/buildbot_config/config/master.py +0 -24
- data/test/buildbot/buildbot_config/config/slave.py +0 -22
- data/test/buildbot/buildbot_config/master/__init__.py +0 -6
- data/test/buildbot/buildbot_config/master/builders.py +0 -78
- data/test/buildbot/buildbot_config/master/buildsteps.py +0 -100
- data/test/buildbot/buildbot_config/master/change_sources.py +0 -8
- data/test/buildbot/buildbot_config/master/schedulers.py +0 -32
- data/test/buildbot/buildbot_config/master/slaves.py +0 -60
- data/test/buildbot/buildbot_config/master/status.py +0 -52
- data/test/buildbot/master/Makefile.sample +0 -28
- data/test/buildbot/master/buildbot.tac +0 -36
- data/test/buildbot/master/master.cfg +0 -67
- data/test/buildbot/master/public_html/bg_gradient.jpg +0 -0
- data/test/buildbot/master/public_html/default.css +0 -545
- data/test/buildbot/master/public_html/favicon.ico +0 -0
- data/test/buildbot/master/public_html/robots.txt +0 -10
- data/test/buildbot/master/public_html/static/css/bootstrap-1.4.0.min.css +0 -356
- data/test/buildbot/master/public_html/static/css/prettify.css +0 -97
- data/test/buildbot/master/public_html/static/css/syntax.css +0 -60
- data/test/buildbot/master/public_html/static/css/vagrant.base.css +0 -205
- data/test/buildbot/master/public_html/static/images/base_box_mac.jpg +0 -0
- data/test/buildbot/master/public_html/static/images/getting-started/success.jpg +0 -0
- data/test/buildbot/master/public_html/static/images/icons/error.png +0 -0
- data/test/buildbot/master/public_html/static/images/vagrant_chilling.png +0 -0
- data/test/buildbot/master/public_html/static/images/vagrant_holding.png +0 -0
- data/test/buildbot/master/public_html/static/images/vagrant_looking.png +0 -0
- data/test/buildbot/master/public_html/static/images/windows/alter_path.jpg +0 -0
- data/test/buildbot/master/public_html/static/images/windows/edit_path.jpg +0 -0
- data/test/buildbot/master/public_html/static/images/windows/environment_variables_button.jpg +0 -0
- data/test/buildbot/master/public_html/static/images/windows/port_and_ppk_path.jpg +0 -0
- data/test/buildbot/master/public_html/static/images/windows/ppk_selection.jpg +0 -0
- data/test/buildbot/master/public_html/static/images/windows/putty_first_screen.jpg +0 -0
- data/test/buildbot/master/public_html/static/images/windows/save_result.jpg +0 -0
- data/test/buildbot/master/public_html/static/images/windows/vbox_manage_default_location.jpg +0 -0
- data/test/buildbot/master/public_html/static/js/bootstrap-tabs.js +0 -80
- data/test/buildbot/master/public_html/static/js/jquery-1.7.min.js +0 -4
- data/test/buildbot/master/templates/authfail.html +0 -9
- data/test/buildbot/master/templates/build.html +0 -205
- data/test/buildbot/master/templates/builder.html +0 -118
- data/test/buildbot/master/templates/builders.html +0 -33
- data/test/buildbot/master/templates/buildslave.html +0 -72
- data/test/buildbot/master/templates/buildslaves.html +0 -70
- data/test/buildbot/master/templates/change.html +0 -15
- data/test/buildbot/master/templates/layouts/base.html +0 -58
- data/test/buildbot/master/templates/macros/box.html +0 -37
- data/test/buildbot/master/templates/macros/build_line.html +0 -50
- data/test/buildbot/master/templates/macros/change.html +0 -81
- data/test/buildbot/master/templates/macros/forms.html +0 -300
- data/test/buildbot/master/templates/root.html +0 -42
- data/test/buildbot/master/templates/waterfall.html +0 -53
- data/test/buildbot/requirements.txt +0 -4
- data/test/buildbot/scripts/deploy.sh +0 -38
- data/test/buildbot/scripts/setup.sh +0 -107
- data/test/buildbot/slave/buildbot.tac +0 -43
- data/test/buildbot/slave/info/admin +0 -1
- data/test/buildbot/slave/info/host +0 -1
- data/test/buildbot/tests/__init__.py +0 -0
- data/test/buildbot/tests/master/__init__.py +0 -0
- data/test/buildbot/tests/master/test_slaves.py +0 -41
- data/test/buildbot/vendor/choices-0.4.0.tar.gz +0 -0
- data/test/config/acceptance_boxes.yml +0 -7
- data/test/support/isolated_environment.rb +0 -46
- data/test/support/tempdir.rb +0 -34
- data/test/unit/base.rb +0 -21
- data/test/unit/support/isolated_environment.rb +0 -47
- data/test/unit/support/shared/base_context.rb +0 -30
- data/test/unit/vagrant/action/builder_test.rb +0 -156
- data/test/unit/vagrant/action/environment_test.rb +0 -16
- data/test/unit/vagrant/action/runner_test.rb +0 -65
- data/test/unit/vagrant/action/warden_test.rb +0 -92
- data/test/unit/vagrant/box_collection_test.rb +0 -56
- data/test/unit/vagrant/box_test.rb +0 -34
- data/test/unit/vagrant/command/base_test.rb +0 -150
- data/test/unit/vagrant/config/base_test.rb +0 -48
- data/test/unit/vagrant/config/loader_test.rb +0 -79
- data/test/unit/vagrant/config/ssh_test.rb +0 -17
- data/test/unit/vagrant/config/top_test.rb +0 -69
- data/test/unit/vagrant/config/vm_test.rb +0 -71
- data/test/unit/vagrant/config_test.rb +0 -27
- data/test/unit/vagrant/data_store_test.rb +0 -79
- data/test/unit/vagrant/downloaders/base_test.rb +0 -18
- data/test/unit/vagrant/downloaders/file_test.rb +0 -75
- data/test/unit/vagrant/downloaders/http_test.rb +0 -19
- data/test/unit/vagrant/environment_test.rb +0 -220
- data/test/unit/vagrant/hosts_test.rb +0 -36
- data/test/unit/vagrant/registry_test.rb +0 -74
- data/test/unit/vagrant/util/ansi_escape_code_remover_test.rb +0 -16
- data/test/unit/vagrant/util/file_checksum_test.rb +0 -23
- data/test/unit/vagrant/util/hash_with_indifferent_access_test.rb +0 -38
- data/test/unit/vagrant/util/is_port_open_test.rb +0 -53
- data/test/unit/vagrant/util/line_endings_helper_test.rb +0 -16
- data/test/unit/vagrant/util/network_ip_test.rb +0 -17
- data/test/unit/vagrant/util/retryable_test.rb +0 -106
- data/test/unit/vagrant_test.rb +0 -27
- data/test/unit_legacy/locales/en.yml +0 -8
- data/test/unit_legacy/test_helper.rb +0 -32
- data/test/unit_legacy/vagrant/action/box/destroy_test.rb +0 -18
- data/test/unit_legacy/vagrant/action/box/download_test.rb +0 -125
- data/test/unit_legacy/vagrant/action/box/package_test.rb +0 -25
- data/test/unit_legacy/vagrant/action/box/unpackage_test.rb +0 -84
- data/test/unit_legacy/vagrant/action/box/verify_test.rb +0 -30
- data/test/unit_legacy/vagrant/action/env/set_test.rb +0 -24
- data/test/unit_legacy/vagrant/action/general/package_test.rb +0 -268
- data/test/unit_legacy/vagrant/action/general/validate_test.rb +0 -31
- data/test/unit_legacy/vagrant/action/vm/boot_test.rb +0 -66
- data/test/unit_legacy/vagrant/action/vm/check_accessible_test.rb +0 -61
- data/test/unit_legacy/vagrant/action/vm/check_box_test.rb +0 -61
- data/test/unit_legacy/vagrant/action/vm/check_guest_additions_test.rb +0 -9
- data/test/unit_legacy/vagrant/action/vm/clean_machine_folder_test.rb +0 -84
- data/test/unit_legacy/vagrant/action/vm/clear_forwarded_ports_test.rb +0 -52
- data/test/unit_legacy/vagrant/action/vm/clear_nfs_exports_test.rb +0 -22
- data/test/unit_legacy/vagrant/action/vm/clear_shared_folders_test.rb +0 -40
- data/test/unit_legacy/vagrant/action/vm/customize_test.rb +0 -37
- data/test/unit_legacy/vagrant/action/vm/destroy_test.rb +0 -25
- data/test/unit_legacy/vagrant/action/vm/destroy_unused_network_interfaces_test.rb +0 -49
- data/test/unit_legacy/vagrant/action/vm/discard_state_test.rb +0 -45
- data/test/unit_legacy/vagrant/action/vm/export_test.rb +0 -107
- data/test/unit_legacy/vagrant/action/vm/forward_ports_helpers_test.rb +0 -77
- data/test/unit_legacy/vagrant/action/vm/forward_ports_test.rb +0 -197
- data/test/unit_legacy/vagrant/action/vm/halt_test.rb +0 -79
- data/test/unit_legacy/vagrant/action/vm/host_name_test.rb +0 -36
- data/test/unit_legacy/vagrant/action/vm/import_test.rb +0 -66
- data/test/unit_legacy/vagrant/action/vm/match_mac_address_test.rb +0 -40
- data/test/unit_legacy/vagrant/action/vm/modify_test.rb +0 -38
- data/test/unit_legacy/vagrant/action/vm/network_test.rb +0 -286
- data/test/unit_legacy/vagrant/action/vm/nfs_helpers_test.rb +0 -26
- data/test/unit_legacy/vagrant/action/vm/nfs_test.rb +0 -260
- data/test/unit_legacy/vagrant/action/vm/package_test.rb +0 -25
- data/test/unit_legacy/vagrant/action/vm/package_vagrantfile_test.rb +0 -46
- data/test/unit_legacy/vagrant/action/vm/provision_test.rb +0 -65
- data/test/unit_legacy/vagrant/action/vm/provisioner_cleanup_test.rb +0 -56
- data/test/unit_legacy/vagrant/action/vm/resume_test.rb +0 -35
- data/test/unit_legacy/vagrant/action/vm/share_folders_test.rb +0 -144
- data/test/unit_legacy/vagrant/action/vm/suspend_test.rb +0 -35
- data/test/unit_legacy/vagrant/action_test.rb +0 -89
- data/test/unit_legacy/vagrant/box_collection_test.rb +0 -45
- data/test/unit_legacy/vagrant/box_test.rb +0 -74
- data/test/unit_legacy/vagrant/cli_test.rb +0 -35
- data/test/unit_legacy/vagrant/command/base_test.rb +0 -23
- data/test/unit_legacy/vagrant/command/group_base_test.rb +0 -15
- data/test/unit_legacy/vagrant/command/helpers_test.rb +0 -88
- data/test/unit_legacy/vagrant/command/init_test.rb +0 -10
- data/test/unit_legacy/vagrant/command/package_test.rb +0 -27
- data/test/unit_legacy/vagrant/config/base_test.rb +0 -52
- data/test/unit_legacy/vagrant/config/error_recorder_test.rb +0 -18
- data/test/unit_legacy/vagrant/config/ssh_test.rb +0 -12
- data/test/unit_legacy/vagrant/config/vagrant_test.rb +0 -35
- data/test/unit_legacy/vagrant/config/vm/provisioner_test.rb +0 -92
- data/test/unit_legacy/vagrant/config/vm_test.rb +0 -47
- data/test/unit_legacy/vagrant/config_test.rb +0 -148
- data/test/unit_legacy/vagrant/downloaders/http_test.rb +0 -93
- data/test/unit_legacy/vagrant/environment_test.rb +0 -539
- data/test/unit_legacy/vagrant/errors_test.rb +0 -42
- data/test/unit_legacy/vagrant/hosts/base_test.rb +0 -46
- data/test/unit_legacy/vagrant/hosts/bsd_test.rb +0 -53
- data/test/unit_legacy/vagrant/hosts/linux_test.rb +0 -54
- data/test/unit_legacy/vagrant/plugin_test.rb +0 -9
- data/test/unit_legacy/vagrant/provisioners/base_test.rb +0 -63
- data/test/unit_legacy/vagrant/provisioners/chef_client_test.rb +0 -190
- data/test/unit_legacy/vagrant/provisioners/chef_solo_test.rb +0 -115
- data/test/unit_legacy/vagrant/provisioners/chef_test.rb +0 -209
- data/test/unit_legacy/vagrant/provisioners/puppet_server_test.rb +0 -68
- data/test/unit_legacy/vagrant/provisioners/puppet_test.rb +0 -182
- data/test/unit_legacy/vagrant/provisioners/shell_test.rb +0 -79
- data/test/unit_legacy/vagrant/ssh/session_test.rb +0 -40
- data/test/unit_legacy/vagrant/ssh_test.rb +0 -304
- data/test/unit_legacy/vagrant/systems/base_test.rb +0 -18
- data/test/unit_legacy/vagrant/systems/linux_test.rb +0 -104
- data/test/unit_legacy/vagrant/util/busy_test.rb +0 -106
- data/test/unit_legacy/vagrant/util/counter_test.rb +0 -29
- data/test/unit_legacy/vagrant/util/platform_test.rb +0 -18
- data/test/unit_legacy/vagrant/util/stacked_proc_runner_test.rb +0 -43
- data/test/unit_legacy/vagrant/util/template_renderer_test.rb +0 -145
- data/test/unit_legacy/vagrant/vm_test.rb +0 -300
@@ -1,230 +0,0 @@
|
|
1
|
-
require 'timeout'
|
2
|
-
|
3
|
-
require 'log4r'
|
4
|
-
require 'net/ssh'
|
5
|
-
require 'net/scp'
|
6
|
-
|
7
|
-
require 'vagrant/util/ansi_escape_code_remover'
|
8
|
-
require 'vagrant/util/file_mode'
|
9
|
-
require 'vagrant/util/platform'
|
10
|
-
require 'vagrant/util/retryable'
|
11
|
-
|
12
|
-
module Vagrant
|
13
|
-
module Communication
|
14
|
-
# Provides communication with the VM via SSH.
|
15
|
-
class SSH < Base
|
16
|
-
include Util::ANSIEscapeCodeRemover
|
17
|
-
include Util::Retryable
|
18
|
-
|
19
|
-
def initialize(vm)
|
20
|
-
@vm = vm
|
21
|
-
@logger = Log4r::Logger.new("vagrant::communication::ssh")
|
22
|
-
@connection = nil
|
23
|
-
end
|
24
|
-
|
25
|
-
def ready?
|
26
|
-
@logger.debug("Checking whether SSH is ready...")
|
27
|
-
|
28
|
-
Timeout.timeout(@vm.config.ssh.timeout) do
|
29
|
-
connect
|
30
|
-
end
|
31
|
-
|
32
|
-
# If we reached this point then we successfully connected
|
33
|
-
@logger.info("SSH is ready!")
|
34
|
-
true
|
35
|
-
rescue Timeout::Error, Errors::SSHConnectionRefused, Net::SSH::Disconnect => e
|
36
|
-
# The above errors represent various reasons that SSH may not be
|
37
|
-
# ready yet. Return false.
|
38
|
-
@logger.info("SSH not up: #{e.inspect}")
|
39
|
-
return false
|
40
|
-
end
|
41
|
-
|
42
|
-
def execute(command, opts=nil, &block)
|
43
|
-
opts = {
|
44
|
-
:error_check => true,
|
45
|
-
:error_class => Errors::VagrantError,
|
46
|
-
:error_key => :ssh_bad_exit_status,
|
47
|
-
:command => command,
|
48
|
-
:sudo => false
|
49
|
-
}.merge(opts || {})
|
50
|
-
|
51
|
-
# Connect via SSH and execute the command in the shell.
|
52
|
-
exit_status = connect do |connection|
|
53
|
-
shell_execute(connection, command, opts[:sudo], &block)
|
54
|
-
end
|
55
|
-
|
56
|
-
# Check for any errors
|
57
|
-
if opts[:error_check] && exit_status != 0
|
58
|
-
# The error classes expect the translation key to be _key,
|
59
|
-
# but that makes for an ugly configuration parameter, so we
|
60
|
-
# set it here from `error_key`
|
61
|
-
error_opts = opts.merge(:_key => opts[:error_key])
|
62
|
-
raise opts[:error_class], error_opts
|
63
|
-
end
|
64
|
-
|
65
|
-
# Return the exit status
|
66
|
-
exit_status
|
67
|
-
end
|
68
|
-
|
69
|
-
def sudo(command, opts=nil, &block)
|
70
|
-
# Run `execute` but with the `sudo` option.
|
71
|
-
opts = { :sudo => true }.merge(opts || {})
|
72
|
-
execute(command, opts, &block)
|
73
|
-
end
|
74
|
-
|
75
|
-
def upload(from, to)
|
76
|
-
@logger.debug("Uploading: #{from} to #{to}")
|
77
|
-
|
78
|
-
# Do an SCP-based upload...
|
79
|
-
connect do |connection|
|
80
|
-
# Open file read only to fix issue #1036
|
81
|
-
scp = Net::SCP.new(connection)
|
82
|
-
scp.upload!(File.open(from, "r"), to)
|
83
|
-
end
|
84
|
-
rescue Net::SCP::Error => e
|
85
|
-
# If we get the exit code of 127, then this means SCP is unavailable.
|
86
|
-
raise Errors::SCPUnavailable if e.message =~ /\(127\)/
|
87
|
-
|
88
|
-
# Otherwise, just raise the error up
|
89
|
-
raise
|
90
|
-
end
|
91
|
-
|
92
|
-
protected
|
93
|
-
|
94
|
-
# Opens an SSH connection and yields it to a block.
|
95
|
-
def connect
|
96
|
-
if @connection && !@connection.closed?
|
97
|
-
# There is a chance that the socket is closed despite us checking
|
98
|
-
# 'closed?' above. To test this we need to send data through the
|
99
|
-
# socket.
|
100
|
-
begin
|
101
|
-
@connection.exec!("")
|
102
|
-
rescue IOError
|
103
|
-
@logger.info("Connection has been closed. Not re-using.")
|
104
|
-
@connection = nil
|
105
|
-
end
|
106
|
-
|
107
|
-
# If the @connection is still around, then it is valid,
|
108
|
-
# and we use it.
|
109
|
-
if @connection
|
110
|
-
@logger.debug("Re-using SSH connection.")
|
111
|
-
return yield @connection if block_given?
|
112
|
-
return
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
ssh_info = @vm.ssh.info
|
117
|
-
|
118
|
-
# Build the options we'll use to initiate the connection via Net::SSH
|
119
|
-
opts = {
|
120
|
-
:port => ssh_info[:port],
|
121
|
-
:keys => [ssh_info[:private_key_path]],
|
122
|
-
:keys_only => true,
|
123
|
-
:user_known_hosts_file => [],
|
124
|
-
:paranoid => false,
|
125
|
-
:config => false,
|
126
|
-
:forward_agent => ssh_info[:forward_agent]
|
127
|
-
}
|
128
|
-
|
129
|
-
# Check that the private key permissions are valid
|
130
|
-
@vm.ssh.check_key_permissions(ssh_info[:private_key_path])
|
131
|
-
|
132
|
-
# Connect to SSH, giving it a few tries
|
133
|
-
connection = nil
|
134
|
-
begin
|
135
|
-
# These are the exceptions that we retry because they represent
|
136
|
-
# errors that are generally fixed from a retry and don't
|
137
|
-
# necessarily represent immediate failure cases.
|
138
|
-
exceptions = [
|
139
|
-
Errno::ECONNREFUSED,
|
140
|
-
Errno::EHOSTUNREACH,
|
141
|
-
Net::SSH::Disconnect,
|
142
|
-
Timeout::Error
|
143
|
-
]
|
144
|
-
|
145
|
-
@logger.info("Connecting to SSH: #{ssh_info[:host]}:#{ssh_info[:port]}")
|
146
|
-
connection = retryable(:tries => @vm.config.ssh.max_tries, :on => exceptions) do
|
147
|
-
Net::SSH.start(ssh_info[:host], ssh_info[:username], opts)
|
148
|
-
end
|
149
|
-
rescue Net::SSH::AuthenticationFailed
|
150
|
-
# This happens if authentication failed. We wrap the error in our
|
151
|
-
# own exception.
|
152
|
-
raise Errors::SSHAuthenticationFailed
|
153
|
-
rescue Errno::ECONNREFUSED
|
154
|
-
# This is raised if we failed to connect the max amount of times
|
155
|
-
raise Errors::SSHConnectionRefused
|
156
|
-
rescue NotImplementedError
|
157
|
-
# This is raised if a private key type that Net-SSH doesn't support
|
158
|
-
# is used. Show a nicer error.
|
159
|
-
raise Errors::SSHKeyTypeNotSupported
|
160
|
-
end
|
161
|
-
|
162
|
-
@connection = connection
|
163
|
-
|
164
|
-
# This is hacky but actually helps with some issues where
|
165
|
-
# Net::SSH is simply not robust enough to handle... see
|
166
|
-
# issue #391, #455, etc.
|
167
|
-
sleep 4
|
168
|
-
|
169
|
-
# Yield the connection that is ready to be used and
|
170
|
-
# return the value of the block
|
171
|
-
return yield connection if block_given?
|
172
|
-
end
|
173
|
-
|
174
|
-
# Executes the command on an SSH connection within a login shell.
|
175
|
-
def shell_execute(connection, command, sudo=false)
|
176
|
-
@logger.info("Execute: #{command} (sudo=#{sudo.inspect})")
|
177
|
-
exit_status = nil
|
178
|
-
|
179
|
-
# Determine the shell to execute. If we are using `sudo` then we
|
180
|
-
# need to wrap the shell in a `sudo` call.
|
181
|
-
shell = "#{@vm.config.ssh.shell} -l"
|
182
|
-
shell = "sudo -H #{shell}" if sudo
|
183
|
-
|
184
|
-
# Open the channel so we can execute or command
|
185
|
-
channel = connection.open_channel do |ch|
|
186
|
-
ch.exec(shell) do |ch2, _|
|
187
|
-
# Setup the channel callbacks so we can get data and exit status
|
188
|
-
ch2.on_data do |ch3, data|
|
189
|
-
if block_given?
|
190
|
-
# Filter out the clear screen command
|
191
|
-
data = remove_ansi_escape_codes(data)
|
192
|
-
@logger.debug("stdout: #{data}")
|
193
|
-
yield :stdout, data
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
ch2.on_extended_data do |ch3, type, data|
|
198
|
-
if block_given?
|
199
|
-
# Filter out the clear screen command
|
200
|
-
data = remove_ansi_escape_codes(data)
|
201
|
-
@logger.debug("stderr: #{data}")
|
202
|
-
yield :stderr, data
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
ch2.on_request("exit-status") do |ch3, data|
|
207
|
-
exit_status = data.read_long
|
208
|
-
@logger.debug("Exit status: #{exit_status}")
|
209
|
-
end
|
210
|
-
|
211
|
-
# Set the terminal
|
212
|
-
ch2.send_data "export TERM=vt100\n"
|
213
|
-
|
214
|
-
# Output the command
|
215
|
-
ch2.send_data "#{command}\n"
|
216
|
-
|
217
|
-
# Remember to exit or this channel will hang open
|
218
|
-
ch2.send_data "exit\n"
|
219
|
-
end
|
220
|
-
end
|
221
|
-
|
222
|
-
# Wait for the channel to complete
|
223
|
-
channel.wait
|
224
|
-
|
225
|
-
# Return the final exit status
|
226
|
-
return exit_status
|
227
|
-
end
|
228
|
-
end
|
229
|
-
end
|
230
|
-
end
|
data/lib/vagrant/config.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
module Vagrant
|
2
|
-
module Config
|
3
|
-
autoload :Base, 'vagrant/config/base'
|
4
|
-
autoload :Container, 'vagrant/config/container'
|
5
|
-
autoload :ErrorRecorder, 'vagrant/config/error_recorder'
|
6
|
-
autoload :Loader, 'vagrant/config/loader'
|
7
|
-
autoload :Top, 'vagrant/config/top'
|
8
|
-
|
9
|
-
autoload :NFSConfig, 'vagrant/config/nfs'
|
10
|
-
autoload :PackageConfig, 'vagrant/config/package'
|
11
|
-
autoload :SSHConfig, 'vagrant/config/ssh'
|
12
|
-
autoload :VagrantConfig, 'vagrant/config/vagrant'
|
13
|
-
autoload :VMConfig, 'vagrant/config/vm'
|
14
|
-
|
15
|
-
CONFIGURE_MUTEX = Mutex.new
|
16
|
-
|
17
|
-
# This is the method which is called by all Vagrantfiles to configure Vagrant.
|
18
|
-
# This method expects a block which accepts a single argument representing
|
19
|
-
# an instance of the {Config::Top} class.
|
20
|
-
#
|
21
|
-
# Note that the block is not run immediately. Instead, it's proc is stored
|
22
|
-
# away for execution later.
|
23
|
-
def self.run(&block)
|
24
|
-
# Store it for later
|
25
|
-
@last_procs ||= []
|
26
|
-
@last_procs << block
|
27
|
-
end
|
28
|
-
|
29
|
-
# This is a method which will yield to a block and will capture all
|
30
|
-
# ``Vagrant.configure`` calls, returning an array of `Proc`s.
|
31
|
-
#
|
32
|
-
# Wrapping this around anytime you call code which loads configurations
|
33
|
-
# will force a mutex so that procs never get mixed up. This keeps
|
34
|
-
# the configuration loading part of Vagrant thread-safe.
|
35
|
-
def self.capture_configures
|
36
|
-
CONFIGURE_MUTEX.synchronize do
|
37
|
-
# Reset the last procs so that we start fresh
|
38
|
-
@last_procs = []
|
39
|
-
|
40
|
-
# Yield to allow the caller to do whatever loading needed
|
41
|
-
yield
|
42
|
-
|
43
|
-
# Return the last procs we've seen while still in the mutex,
|
44
|
-
# knowing we're safe.
|
45
|
-
return @last_procs
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
data/lib/vagrant/config/base.rb
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
module Vagrant
|
2
|
-
module Config
|
3
|
-
# The base class for all configuration classes. This implements
|
4
|
-
# basic things such as the environment instance variable which all
|
5
|
-
# config classes need as well as a basic `to_json` implementation.
|
6
|
-
class Base
|
7
|
-
# Loads configuration values from JSON back into the proper
|
8
|
-
# configuration classes. By default, this is done by simply
|
9
|
-
# iterating over all values in the JSON hash and assigning them
|
10
|
-
# to instance variables on the class.
|
11
|
-
def self.json_create(data)
|
12
|
-
data.inject(new) do |result, data|
|
13
|
-
key, value = data
|
14
|
-
result.instance_variable_set("@#{key}".to_sym, value) if key != "json_class"
|
15
|
-
result
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
# Allows setting options from a hash. By default this simply calls
|
20
|
-
# the `#{key}=` method on the config class with the value, which is
|
21
|
-
# the expected behavior most of the time.
|
22
|
-
def set_options(options)
|
23
|
-
options.each do |key, value|
|
24
|
-
send("#{key}=", value)
|
25
|
-
end
|
26
|
-
end
|
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
|
-
# Ignore keys that start with a double underscore. This allows
|
37
|
-
# configuration classes to still hold around internal state
|
38
|
-
# that isn't propagated.
|
39
|
-
if !key.start_with?("__")
|
40
|
-
result.instance_variable_set("@#{key}".to_sym, value)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
result
|
45
|
-
end
|
46
|
-
|
47
|
-
# Called by {Top} after the configuration is loaded to validate
|
48
|
-
# the configuaration objects. Subclasses should implement this
|
49
|
-
# method and add any errors to the `errors` object given.
|
50
|
-
#
|
51
|
-
# @param [ErrorRecorder] errors
|
52
|
-
def validate(env, errors); end
|
53
|
-
|
54
|
-
# Converts the configuration to a raw hash by calling `#to_hash`
|
55
|
-
# on all instance variables (if it can) and putting them into
|
56
|
-
# a hash.
|
57
|
-
def to_hash
|
58
|
-
instance_variables_hash.inject({}) do |acc, data|
|
59
|
-
k,v = data
|
60
|
-
v = v.to_hash if v.respond_to?(:to_hash)
|
61
|
-
acc[k] = v
|
62
|
-
acc
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
# Converts to JSON, with the `json_class` field set so that when
|
67
|
-
# the JSON is parsed back, it can be loaded back into the proper class.
|
68
|
-
# See {json_create}.
|
69
|
-
def to_json(*a)
|
70
|
-
instance_variables_hash.to_json(*a)
|
71
|
-
end
|
72
|
-
|
73
|
-
# Returns the instance variables as a hash of key-value pairs.
|
74
|
-
def instance_variables_hash
|
75
|
-
instance_variables.inject({}) do |acc, iv|
|
76
|
-
acc[iv.to_s[1..-1]] = instance_variable_get(iv)
|
77
|
-
acc
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
@@ -1,37 +0,0 @@
|
|
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
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Vagrant
|
2
|
-
module Config
|
3
|
-
# A class which is passed into the various {Base#validate} methods and
|
4
|
-
# can be used as a helper to add error messages about a single config
|
5
|
-
# class.
|
6
|
-
class ErrorRecorder
|
7
|
-
attr_reader :errors
|
8
|
-
|
9
|
-
def initialize
|
10
|
-
@errors = []
|
11
|
-
end
|
12
|
-
|
13
|
-
# Adds an error to the list of errors.
|
14
|
-
def add(message)
|
15
|
-
@errors << message
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,127 +0,0 @@
|
|
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
|
-
else
|
86
|
-
@logger.debug("Loading from: #{key} (cache)")
|
87
|
-
end
|
88
|
-
|
89
|
-
# Merge in the results of this proc's configuration
|
90
|
-
result = result.merge(@config_cache[proc])
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
@logger.debug("Configuration loaded successfully")
|
95
|
-
result
|
96
|
-
end
|
97
|
-
|
98
|
-
protected
|
99
|
-
|
100
|
-
# This returns an array of `Proc` objects for the given source.
|
101
|
-
# The `Proc` objects returned will expect a single argument for
|
102
|
-
# the configuration object and are expected to mutate this
|
103
|
-
# configuration object.
|
104
|
-
def procs_for_source(source)
|
105
|
-
return [source] if source.is_a?(Proc)
|
106
|
-
|
107
|
-
# Assume all string sources are actually pathnames
|
108
|
-
source = Pathname.new(source) if source.is_a?(String)
|
109
|
-
|
110
|
-
if source.is_a?(Pathname)
|
111
|
-
@logger.debug("Load procs for pathname: #{source.inspect}")
|
112
|
-
|
113
|
-
begin
|
114
|
-
return Config.capture_configures do
|
115
|
-
Kernel.load source
|
116
|
-
end
|
117
|
-
rescue SyntaxError => e
|
118
|
-
# Report syntax errors in a nice way.
|
119
|
-
raise Errors::VagrantfileSyntaxError, :file => e.message
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
raise Exception, "Unknown configuration source: #{source.inspect}"
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|