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,92 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
class ConfigVMProvisionerTest < Test::Unit::TestCase
|
4
|
-
setup do
|
5
|
-
@klass = Vagrant::Config::VMConfig::Provisioner
|
6
|
-
@top = Vagrant::Config::Top.new(nil)
|
7
|
-
end
|
8
|
-
|
9
|
-
context "initializing" do
|
10
|
-
should "expose the top instance that the provisioner belongs to" do
|
11
|
-
instance = @klass.new(@top, :chef_solo)
|
12
|
-
assert_equal @top, instance.top
|
13
|
-
end
|
14
|
-
|
15
|
-
should "expose the shortcut used" do
|
16
|
-
instance = @klass.new(@top, :chef_solo)
|
17
|
-
assert_equal :chef_solo, instance.shortcut
|
18
|
-
end
|
19
|
-
|
20
|
-
should "expose the provisioner class if its a valid shortcut" do
|
21
|
-
instance = @klass.new(@top, :chef_solo)
|
22
|
-
assert_equal Vagrant::Provisioners::ChefSolo, instance.provisioner
|
23
|
-
end
|
24
|
-
|
25
|
-
should "expose the provisioner class if its a valid class" do
|
26
|
-
instance = @klass.new(@top, Vagrant::Provisioners::ChefSolo)
|
27
|
-
assert_equal Vagrant::Provisioners::ChefSolo, instance.provisioner
|
28
|
-
end
|
29
|
-
|
30
|
-
should "have a nil provisioner class if invalid" do
|
31
|
-
instance = @klass.new(@top, :i_shall_never_exist)
|
32
|
-
assert_nil instance.provisioner
|
33
|
-
end
|
34
|
-
|
35
|
-
should "have a nil config instance if invalid" do
|
36
|
-
instance = @klass.new(@top, :i_shall_never_exist)
|
37
|
-
assert_nil instance.config
|
38
|
-
end
|
39
|
-
|
40
|
-
should "set the top of the config object to the given top" do
|
41
|
-
instance = @klass.new(@top, :chef_solo)
|
42
|
-
assert_equal @top, instance.config.top
|
43
|
-
end
|
44
|
-
|
45
|
-
should "configure the provisioner if valid" do
|
46
|
-
instance = @klass.new(@top, :chef_solo) do |chef|
|
47
|
-
chef.cookbooks_path = "foo"
|
48
|
-
end
|
49
|
-
|
50
|
-
assert_equal "foo", instance.config.cookbooks_path
|
51
|
-
end
|
52
|
-
|
53
|
-
should "configure the provisioner with a hash if valid" do
|
54
|
-
instance = @klass.new(@top, :chef_solo, :cookbooks_path => "foo")
|
55
|
-
assert_equal "foo", instance.config.cookbooks_path
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
context "validation" do
|
60
|
-
setup do
|
61
|
-
@errors = Vagrant::Config::ErrorRecorder.new
|
62
|
-
end
|
63
|
-
|
64
|
-
should "be invalid if provisioner is valid" do
|
65
|
-
instance = @klass.new(@top, :i_shall_never_exist)
|
66
|
-
instance.validate(@errors)
|
67
|
-
assert !@errors.errors.empty?
|
68
|
-
end
|
69
|
-
|
70
|
-
should "be invalid if provisioner doesn't inherit from provisioners base" do
|
71
|
-
klass = Class.new
|
72
|
-
instance = @klass.new(@top, klass)
|
73
|
-
instance.validate(@errors)
|
74
|
-
assert !@errors.errors.empty?
|
75
|
-
end
|
76
|
-
|
77
|
-
should "be valid with a valid provisioner" do
|
78
|
-
instance = @klass.new(@top, :chef_solo) do |chef|
|
79
|
-
chef.add_recipe "foo"
|
80
|
-
end
|
81
|
-
|
82
|
-
instance.validate(@errors)
|
83
|
-
assert @errors.errors.empty?
|
84
|
-
end
|
85
|
-
|
86
|
-
should "be invalid if a provisioner's config is invalid" do
|
87
|
-
instance = @klass.new(@top, :chef_solo)
|
88
|
-
instance.validate(@errors)
|
89
|
-
assert !@errors.errors.empty?
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
class ConfigVMTest < Test::Unit::TestCase
|
4
|
-
setup do
|
5
|
-
@username = "mitchellh"
|
6
|
-
|
7
|
-
@env = vagrant_env
|
8
|
-
@config = @env.config.vm
|
9
|
-
@env.config.ssh.username = @username
|
10
|
-
end
|
11
|
-
|
12
|
-
context "defining VMs" do
|
13
|
-
should "store the proc by name but not run it" do
|
14
|
-
foo = mock("proc")
|
15
|
-
foo.expects(:call).never
|
16
|
-
|
17
|
-
proc = Proc.new { foo.call }
|
18
|
-
@config.define(:name, &proc)
|
19
|
-
assert @config.defined_vms[:name].proc_stack.include?(proc)
|
20
|
-
end
|
21
|
-
|
22
|
-
should "store the options" do
|
23
|
-
@config.define(:name, :set => true)
|
24
|
-
assert @config.defined_vms[:name].options[:set]
|
25
|
-
end
|
26
|
-
|
27
|
-
should "retain vm definition order" do
|
28
|
-
@config.define(:a) {}
|
29
|
-
@config.define(:b) {}
|
30
|
-
@config.define(:c) {}
|
31
|
-
|
32
|
-
assert_equal [:a, :b, :c], @config.defined_vm_keys
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
context "customizing" do
|
37
|
-
should "include the stacked proc runner module" do
|
38
|
-
assert @config.class.included_modules.include?(Vagrant::Util::StackedProcRunner)
|
39
|
-
end
|
40
|
-
|
41
|
-
should "add the customize proc to the proc stack" do
|
42
|
-
proc = Proc.new {}
|
43
|
-
@config.customize(&proc)
|
44
|
-
assert @config.proc_stack.include?(proc)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,148 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
class ConfigTest < Test::Unit::TestCase
|
4
|
-
setup do
|
5
|
-
@klass = Vagrant::Config
|
6
|
-
end
|
7
|
-
|
8
|
-
context "with an instance" do
|
9
|
-
setup do
|
10
|
-
@instance = @klass.new
|
11
|
-
end
|
12
|
-
|
13
|
-
should "load the config files in the given order" do
|
14
|
-
names = %w{alpha beta gamma}
|
15
|
-
|
16
|
-
@instance.load_order = [:alpha, :beta]
|
17
|
-
|
18
|
-
names.each do |name|
|
19
|
-
vagrantfile(vagrant_box(name), "config.vm.box = '#{name}'")
|
20
|
-
@instance.set(name.to_sym, vagrant_box(name).join("Vagrantfile"))
|
21
|
-
end
|
22
|
-
|
23
|
-
config = @instance.load(nil)
|
24
|
-
assert_equal "beta", config.vm.box
|
25
|
-
end
|
26
|
-
|
27
|
-
should "load the config as procs" do
|
28
|
-
@instance.set(:proc, Proc.new { |config| config.vm.box = "proc" })
|
29
|
-
@instance.load_order = [:proc]
|
30
|
-
config = @instance.load(nil)
|
31
|
-
|
32
|
-
assert_equal "proc", config.vm.box
|
33
|
-
end
|
34
|
-
|
35
|
-
should "load an array of procs" do
|
36
|
-
@instance.set(:proc, [Proc.new { |config| config.vm.box = "proc" },
|
37
|
-
Proc.new { |config| config.vm.box = "proc2" }])
|
38
|
-
@instance.load_order = [:proc]
|
39
|
-
config = @instance.load(nil)
|
40
|
-
|
41
|
-
assert_equal "proc2", config.vm.box
|
42
|
-
end
|
43
|
-
|
44
|
-
should "not care if a file doesn't exist" do
|
45
|
-
@instance.load_order = [:foo]
|
46
|
-
assert_nothing_raised { @instance.set(:foo, "i/dont/exist") }
|
47
|
-
assert_nothing_raised { @instance.load(nil) }
|
48
|
-
end
|
49
|
-
|
50
|
-
should "not reload a file" do
|
51
|
-
foo_path = vagrant_box("foo").join("Vagrantfile")
|
52
|
-
|
53
|
-
vagrantfile(vagrant_box("foo"))
|
54
|
-
@instance.set(:foo, foo_path)
|
55
|
-
|
56
|
-
# Nothing should be raised in this case because the file isn't reloaded
|
57
|
-
vagrantfile(vagrant_box("foo"), "^%&8318")
|
58
|
-
assert_nothing_raised { @instance.set(:foo, foo_path) }
|
59
|
-
end
|
60
|
-
|
61
|
-
should "raise an exception if there is a syntax error in a file" do
|
62
|
-
vagrantfile(vagrant_box("foo"), "^%&8318")
|
63
|
-
|
64
|
-
assert_raises(Vagrant::Errors::VagrantfileSyntaxError) {
|
65
|
-
@instance.set(:foo, vagrant_box("foo").join("Vagrantfile"))
|
66
|
-
}
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
context "top config class" do
|
71
|
-
setup do
|
72
|
-
@configures_list = {}
|
73
|
-
@klass::Top.stubs(:configures_list).returns(@configures_list)
|
74
|
-
end
|
75
|
-
|
76
|
-
context "adding configure keys" do
|
77
|
-
setup do
|
78
|
-
@key = "top_config_foo"
|
79
|
-
@config_klass = mock("klass")
|
80
|
-
end
|
81
|
-
|
82
|
-
should "add key and klass to configures list" do
|
83
|
-
@klass::Top.configures(@key, @config_klass)
|
84
|
-
assert_equal @config_klass, @configures_list[@key]
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
context "configuration keys on instance" do
|
89
|
-
setup do
|
90
|
-
@configures_list.clear
|
91
|
-
end
|
92
|
-
|
93
|
-
should "initialize each configurer and set it to its key" do
|
94
|
-
env = mock('env')
|
95
|
-
|
96
|
-
5.times do |i|
|
97
|
-
key = "key#{i}"
|
98
|
-
klass = mock("klass#{i}")
|
99
|
-
instance = mock("instance#{i}")
|
100
|
-
instance.expects(:top=).with() do |top|
|
101
|
-
assert top.is_a?(@klass::Top)
|
102
|
-
true
|
103
|
-
end
|
104
|
-
klass.expects(:new).returns(instance)
|
105
|
-
@configures_list[key] = klass
|
106
|
-
end
|
107
|
-
|
108
|
-
@klass::Top.new(env)
|
109
|
-
end
|
110
|
-
|
111
|
-
should "allow reading via methods" do
|
112
|
-
key = "my_foo_bar_key"
|
113
|
-
klass = mock("klass")
|
114
|
-
instance = mock("instance")
|
115
|
-
instance.stubs(:top=)
|
116
|
-
klass.expects(:new).returns(instance)
|
117
|
-
@klass::Top.configures(key, klass)
|
118
|
-
|
119
|
-
config = @klass::Top.new
|
120
|
-
assert_equal instance, config.send(key)
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
context "validation" do
|
125
|
-
should "do nothing if no errors are added" do
|
126
|
-
valid_class = Class.new(@klass::Base)
|
127
|
-
@klass::Top.configures(:subconfig, valid_class)
|
128
|
-
instance = @klass::Top.new
|
129
|
-
assert_nothing_raised { instance.validate! }
|
130
|
-
end
|
131
|
-
|
132
|
-
should "raise an exception if there are errors" do
|
133
|
-
invalid_class = Class.new(@klass::Base) do
|
134
|
-
def validate(errors)
|
135
|
-
errors.add("vagrant.test.errors.test_key")
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
@klass::Top.configures(:subconfig, invalid_class)
|
140
|
-
instance = @klass::Top.new
|
141
|
-
|
142
|
-
assert_raises(Vagrant::Errors::ConfigValidationFailed) {
|
143
|
-
instance.validate!
|
144
|
-
}
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
@@ -1,93 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
class HttpDownloaderTest < Test::Unit::TestCase
|
4
|
-
setup do
|
5
|
-
@downloader, @tempfile = vagrant_mock_downloader(Vagrant::Downloaders::HTTP)
|
6
|
-
@downloader.stubs(:report_progress)
|
7
|
-
@downloader.stubs(:complete_progress)
|
8
|
-
@uri = "http://google.com/"
|
9
|
-
@headers = nil
|
10
|
-
end
|
11
|
-
|
12
|
-
context "downloading" do
|
13
|
-
setup do
|
14
|
-
ENV["http_proxy"] = nil
|
15
|
-
|
16
|
-
@parsed_uri = URI.parse(@uri)
|
17
|
-
@http = Net::HTTP.new(@parsed_uri.host, @parsed_uri.port)
|
18
|
-
Net::HTTP.stubs(:new).returns(@http)
|
19
|
-
@http.stubs(:start)
|
20
|
-
end
|
21
|
-
|
22
|
-
should "create a proper net/http object" do
|
23
|
-
Net::HTTP.expects(:new).with(@parsed_uri.host, @parsed_uri.port, nil, nil, nil, nil).once.returns(@http)
|
24
|
-
@http.expects(:start)
|
25
|
-
@downloader.download!(@uri, @tempfile)
|
26
|
-
end
|
27
|
-
|
28
|
-
should "create a proper net/http object with a proxy" do
|
29
|
-
ENV["http_proxy"] = "http://user:foo@google.com"
|
30
|
-
@proxy = URI.parse(ENV["http_proxy"])
|
31
|
-
Net::HTTP.expects(:new).with(@parsed_uri.host, @parsed_uri.port, @proxy.host, @proxy.port, @proxy.user, @proxy.password).once.returns(@http)
|
32
|
-
@http.expects(:start)
|
33
|
-
@downloader.download!(@uri, @tempfile)
|
34
|
-
end
|
35
|
-
|
36
|
-
should "create a proper net/http object without a proxy if no_proxy defined" do
|
37
|
-
@uri = "http://somewhere.direct.com/some_file"
|
38
|
-
@parsed_uri = URI.parse(@uri)
|
39
|
-
ENV["http_proxy"] = "http://user:foo@google.com"
|
40
|
-
ENV["no_proxy"] = "direct.com"
|
41
|
-
Net::HTTP.expects(:new).with(@parsed_uri.host, @parsed_uri.port, nil, nil, nil, nil).once.returns(@http)
|
42
|
-
@http.expects(:start)
|
43
|
-
@downloader.download!(@uri, @tempfile)
|
44
|
-
end
|
45
|
-
|
46
|
-
should "enable SSL if scheme is https" do
|
47
|
-
@uri = "https://google.com/"
|
48
|
-
@http.expects(:use_ssl=).with(true).once
|
49
|
-
@downloader.download!(@uri, @tempfile)
|
50
|
-
end
|
51
|
-
|
52
|
-
should "read the body of the response and place each segment into the file" do
|
53
|
-
h = mock("http")
|
54
|
-
response = mock("response")
|
55
|
-
response.stubs(:content_length)
|
56
|
-
response.stubs(:is_a?).with(anything).returns(false)
|
57
|
-
response.stubs(:is_a?).with(Net::HTTPOK).returns(true)
|
58
|
-
segment = mock("segment")
|
59
|
-
segment.stubs(:length).returns(7)
|
60
|
-
|
61
|
-
@http.stubs(:start).yields(h)
|
62
|
-
h.expects(:request_get).with(@parsed_uri.request_uri, @headers).once.yields(response)
|
63
|
-
response.expects(:read_body).once.yields(segment)
|
64
|
-
@tempfile.expects(:write).with(segment).once
|
65
|
-
|
66
|
-
@downloader.download!(@uri, @tempfile)
|
67
|
-
end
|
68
|
-
|
69
|
-
should "error environment if invalid URL given" do
|
70
|
-
Net::HTTP.expects(:new).raises(SocketError.new)
|
71
|
-
|
72
|
-
assert_raises(Vagrant::Errors::DownloaderHTTPSocketError) {
|
73
|
-
@downloader.download!(@uri, @tempfile)
|
74
|
-
}
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
context "matching the uri" do
|
79
|
-
should "use extract to verify that the string is in fact a uri" do
|
80
|
-
URI.expects(:extract).returns(['foo'])
|
81
|
-
assert Vagrant::Downloaders::HTTP.match?('foo')
|
82
|
-
end
|
83
|
-
|
84
|
-
should "return false if there are no extract results" do
|
85
|
-
URI.expects(:extract).returns([])
|
86
|
-
assert !Vagrant::Downloaders::HTTP.match?('foo')
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
context "reporting progress" do
|
91
|
-
# TODO: Testing for this, probably
|
92
|
-
end
|
93
|
-
end
|
@@ -1,539 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
require "pathname"
|
3
|
-
require "tempfile"
|
4
|
-
|
5
|
-
class EnvironmentTest < Test::Unit::TestCase
|
6
|
-
setup do
|
7
|
-
@klass = Vagrant::Environment
|
8
|
-
|
9
|
-
clean_paths
|
10
|
-
end
|
11
|
-
|
12
|
-
context "class method check virtualbox version" do
|
13
|
-
setup do
|
14
|
-
VirtualBox.stubs(:version).returns("4.1.0")
|
15
|
-
end
|
16
|
-
|
17
|
-
should "not error and exit if everything is good" do
|
18
|
-
VirtualBox.expects(:version).returns("4.1.0")
|
19
|
-
assert_nothing_raised { @klass.check_virtualbox! }
|
20
|
-
end
|
21
|
-
|
22
|
-
should "error and exit if VirtualBox is not installed or detected" do
|
23
|
-
VirtualBox.expects(:version).returns(nil)
|
24
|
-
assert_raises(Vagrant::Errors::VirtualBoxNotDetected) { @klass.check_virtualbox! }
|
25
|
-
end
|
26
|
-
|
27
|
-
should "error and exit if VirtualBox is lower than version 4.0" do
|
28
|
-
version = "3.2.12r1041"
|
29
|
-
VirtualBox.expects(:version).returns(version)
|
30
|
-
assert_raises(Vagrant::Errors::VirtualBoxInvalidVersion) { @klass.check_virtualbox! }
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
context "initialization" do
|
35
|
-
should "set the cwd if given" do
|
36
|
-
cwd = "foobarbaz"
|
37
|
-
env = @klass.new(:cwd => cwd)
|
38
|
-
assert_equal Pathname.new(cwd), env.cwd
|
39
|
-
end
|
40
|
-
|
41
|
-
should "default to pwd if cwd is nil" do
|
42
|
-
env = @klass.new
|
43
|
-
assert_equal Pathname.new(Dir.pwd), env.cwd
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
context "paths" do
|
48
|
-
setup do
|
49
|
-
@env = vagrant_env
|
50
|
-
end
|
51
|
-
|
52
|
-
context "dotfile path" do
|
53
|
-
should "build up the dotfile out of the root path and the dotfile name" do
|
54
|
-
assert_equal @env.root_path.join(@env.config.vagrant.dotfile_name), @env.dotfile_path
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
context "home path" do
|
59
|
-
setup do
|
60
|
-
@env = @klass.new
|
61
|
-
|
62
|
-
# Make a fake home directory for helping with tests
|
63
|
-
@home_path = tmp_path.join("home")
|
64
|
-
ENV["HOME"] = @home_path.to_s
|
65
|
-
FileUtils.rm_rf(@home_path)
|
66
|
-
FileUtils.mkdir_p(@home_path)
|
67
|
-
end
|
68
|
-
|
69
|
-
should "return the home path if it loaded" do
|
70
|
-
ENV["VAGRANT_HOME"] = nil
|
71
|
-
|
72
|
-
expected = Pathname.new(File.expand_path(@klass::DEFAULT_HOME))
|
73
|
-
assert_equal expected, @env.home_path
|
74
|
-
end
|
75
|
-
|
76
|
-
should "return the home path set by the environmental variable" do
|
77
|
-
ENV["VAGRANT_HOME"] = "foo"
|
78
|
-
|
79
|
-
expected = Pathname.new(File.expand_path(ENV["VAGRANT_HOME"]))
|
80
|
-
assert_equal expected, @env.home_path
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
context "temp path" do
|
85
|
-
should "return the home path joined with 'tmp'" do
|
86
|
-
assert_equal @env.home_path.join("tmp"), @env.tmp_path
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
context "boxes path" do
|
91
|
-
should "return the home path joined with 'tmp'" do
|
92
|
-
assert_equal @env.home_path.join("boxes"), @env.boxes_path
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
context "resource" do
|
98
|
-
setup do
|
99
|
-
@env = vagrant_env
|
100
|
-
end
|
101
|
-
|
102
|
-
should "return 'vagrant' as a default" do
|
103
|
-
assert_equal 'vagrant', @env.resource
|
104
|
-
end
|
105
|
-
|
106
|
-
should "return the VM name if it is specified" do
|
107
|
-
@env.stubs(:vm).returns(mock("vm", :name => "foo"))
|
108
|
-
assert_equal "foo", @env.resource
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
context "primary VM helper" do
|
113
|
-
should "return the first VM if not multivm" do
|
114
|
-
env = vagrant_env
|
115
|
-
assert_equal env.vms[@klass::DEFAULT_VM], env.primary_vm
|
116
|
-
end
|
117
|
-
|
118
|
-
should "call and return the primary VM from the parent if has one" do
|
119
|
-
env = vagrant_env(vagrantfile(<<-vf))
|
120
|
-
config.vm.define(:web, :primary => true) do; end
|
121
|
-
config.vm.define :db do; end
|
122
|
-
vf
|
123
|
-
|
124
|
-
assert_equal :web, env.primary_vm.name
|
125
|
-
end
|
126
|
-
|
127
|
-
should "return nil if no VM is marked as primary" do
|
128
|
-
env = vagrant_env(vagrantfile(<<-vf))
|
129
|
-
config.vm.define :web
|
130
|
-
config.vm.define :db
|
131
|
-
config.vm.define :utility
|
132
|
-
vf
|
133
|
-
|
134
|
-
assert env.primary_vm.nil?
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
context "multivm? helper" do
|
139
|
-
should "return true if VM length greater than 1" do
|
140
|
-
env = vagrant_env(vagrantfile(<<-vf))
|
141
|
-
config.vm.define :web
|
142
|
-
config.vm.define :db
|
143
|
-
vf
|
144
|
-
|
145
|
-
assert env.multivm?
|
146
|
-
end
|
147
|
-
|
148
|
-
should "return true if VM length is 1 and a sub-VM is defined" do
|
149
|
-
env = vagrant_env(vagrantfile(<<-vf))
|
150
|
-
config.vm.define :web
|
151
|
-
vf
|
152
|
-
|
153
|
-
assert env.multivm?
|
154
|
-
end
|
155
|
-
|
156
|
-
should "return false if only default VM exists" do
|
157
|
-
assert !vagrant_env.multivm?
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
context "local data" do
|
162
|
-
should "lazy load the data store only once" do
|
163
|
-
result = { :foo => :bar }
|
164
|
-
Vagrant::DataStore.expects(:new).returns(result).once
|
165
|
-
env = vagrant_env
|
166
|
-
assert_equal result, env.local_data
|
167
|
-
assert_equal result, env.local_data
|
168
|
-
assert_equal result, env.local_data
|
169
|
-
end
|
170
|
-
|
171
|
-
should "return the parent's local data if a parent exists" do
|
172
|
-
env = vagrant_env(vagrantfile(<<-vf))
|
173
|
-
config.vm.define :web
|
174
|
-
config.vm.define :db
|
175
|
-
vf
|
176
|
-
|
177
|
-
env.local_data[:foo] = :bar
|
178
|
-
|
179
|
-
Vagrant::DataStore.expects(:new).never
|
180
|
-
assert_equal :bar, env.vms[:web].env.local_data[:foo]
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
context "accessing host" do
|
185
|
-
should "load the host once" do
|
186
|
-
env = @klass.new(:cwd => vagrantfile)
|
187
|
-
result = mock("result")
|
188
|
-
Vagrant::Hosts::Base.expects(:load).with(env, env.config.vagrant.host).once.returns(result)
|
189
|
-
assert_equal result, env.host
|
190
|
-
assert_equal result, env.host
|
191
|
-
assert_equal result, env.host
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
context "accessing actions" do
|
196
|
-
should "initialize the Action object with the given environment" do
|
197
|
-
env = @klass.new(:cwd => vagrant_app)
|
198
|
-
result = mock("result")
|
199
|
-
Vagrant::Action.expects(:new).with(env).returns(result).once
|
200
|
-
assert_equal result, env.actions
|
201
|
-
assert_equal result, env.actions
|
202
|
-
assert_equal result, env.actions
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
context "global data" do
|
207
|
-
should "lazy load the data store only once" do
|
208
|
-
env = vagrant_env
|
209
|
-
store = env.global_data
|
210
|
-
|
211
|
-
assert env.global_data.equal?(store)
|
212
|
-
assert env.global_data.equal?(store)
|
213
|
-
assert env.global_data.equal?(store)
|
214
|
-
end
|
215
|
-
|
216
|
-
should "return the parent's global data if a parent exists" do
|
217
|
-
env = vagrant_env(vagrantfile(<<-vf))
|
218
|
-
config.vm.define :web
|
219
|
-
config.vm.define :db
|
220
|
-
vf
|
221
|
-
|
222
|
-
result = env.global_data
|
223
|
-
assert env.vms[:web].env.global_data.equal?(result)
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
context "loading the root path" do
|
228
|
-
should "should walk the parent directories looking for rootfile" do
|
229
|
-
paths = [Pathname.new("/foo/bar/baz"),
|
230
|
-
Pathname.new("/foo/bar"),
|
231
|
-
Pathname.new("/foo"),
|
232
|
-
Pathname.new("/")
|
233
|
-
]
|
234
|
-
|
235
|
-
rootfile = "Foo"
|
236
|
-
|
237
|
-
search_seq = sequence("search_seq")
|
238
|
-
paths.each do |path|
|
239
|
-
File.expects(:exist?).with(path.join(rootfile).to_s).returns(false).in_sequence(search_seq)
|
240
|
-
File.expects(:exist?).with(path).returns(true).in_sequence(search_seq) if !path.root?
|
241
|
-
end
|
242
|
-
|
243
|
-
assert !@klass.new(:cwd => paths.first, :vagrantfile_name => rootfile).root_path
|
244
|
-
end
|
245
|
-
|
246
|
-
should "should set the path for the rootfile" do
|
247
|
-
rootfile = "Foo"
|
248
|
-
path = Pathname.new(File.expand_path("/foo"))
|
249
|
-
File.expects(:exist?).with(path.join(rootfile).to_s).returns(true)
|
250
|
-
|
251
|
-
assert_equal path, @klass.new(:cwd => path, :vagrantfile_name => rootfile).root_path
|
252
|
-
end
|
253
|
-
|
254
|
-
should "not infinite loop on relative paths" do
|
255
|
-
assert @klass.new(:cwd => "../test").root_path.nil?
|
256
|
-
end
|
257
|
-
|
258
|
-
should "only load the root path once" do
|
259
|
-
rootfile = "foo"
|
260
|
-
env = @klass.new(:vagrantfile_name => rootfile)
|
261
|
-
File.expects(:exist?).with(env.cwd.join(rootfile).to_s).returns(true).once
|
262
|
-
|
263
|
-
assert_equal env.cwd, env.root_path
|
264
|
-
assert_equal env.cwd, env.root_path
|
265
|
-
assert_equal env.cwd, env.root_path
|
266
|
-
end
|
267
|
-
|
268
|
-
should "only load the root path once even if nil" do
|
269
|
-
File.stubs(:exist?).returns(false)
|
270
|
-
|
271
|
-
env = @klass.new
|
272
|
-
assert env.root_path.nil?
|
273
|
-
assert env.root_path.nil?
|
274
|
-
assert env.root_path.nil?
|
275
|
-
end
|
276
|
-
end
|
277
|
-
|
278
|
-
context "locking" do
|
279
|
-
setup do
|
280
|
-
@instance = @klass.new(:lock_path => Tempfile.new('vagrant-test').path)
|
281
|
-
end
|
282
|
-
|
283
|
-
should "allow nesting locks" do
|
284
|
-
assert_nothing_raised do
|
285
|
-
@instance.lock do
|
286
|
-
@instance.lock do
|
287
|
-
# Nothing
|
288
|
-
end
|
289
|
-
end
|
290
|
-
end
|
291
|
-
end
|
292
|
-
|
293
|
-
should "raise an exception if an environment already has a lock" do
|
294
|
-
@another = @klass.new(:lock_path => @instance.lock_path)
|
295
|
-
|
296
|
-
# Create first locked thread which should succeed
|
297
|
-
first = Thread.new do
|
298
|
-
begin
|
299
|
-
@instance.lock do
|
300
|
-
Thread.current[:locked] = true
|
301
|
-
loop { sleep 1000 }
|
302
|
-
end
|
303
|
-
rescue Vagrant::Errors::EnvironmentLockedError
|
304
|
-
Thread.current[:locked] = false
|
305
|
-
end
|
306
|
-
end
|
307
|
-
|
308
|
-
# Wait until the first thread has acquired the lock
|
309
|
-
loop do
|
310
|
-
break if first[:locked] || !first.alive?
|
311
|
-
Thread.pass
|
312
|
-
end
|
313
|
-
|
314
|
-
# Verify that the fist got the lock
|
315
|
-
assert first[:locked]
|
316
|
-
|
317
|
-
# Create second locked thread which should fail
|
318
|
-
second = Thread.new do
|
319
|
-
begin
|
320
|
-
@another.lock do
|
321
|
-
Thread.current[:error] = false
|
322
|
-
end
|
323
|
-
rescue Vagrant::Errors::EnvironmentLockedError
|
324
|
-
Thread.current[:error] = true
|
325
|
-
end
|
326
|
-
end
|
327
|
-
|
328
|
-
# Wait for the second to end and verify it failed
|
329
|
-
second.join
|
330
|
-
assert second[:error]
|
331
|
-
|
332
|
-
# Make sure both threads are killed
|
333
|
-
first.kill
|
334
|
-
second.kill
|
335
|
-
end
|
336
|
-
end
|
337
|
-
|
338
|
-
context "accessing the configuration" do
|
339
|
-
should "load the environment if its not already loaded" do
|
340
|
-
env = @klass.new(:cwd => vagrantfile)
|
341
|
-
env.expects(:load!).once
|
342
|
-
env.config
|
343
|
-
end
|
344
|
-
|
345
|
-
should "not load the environment if its already loaded" do
|
346
|
-
env = vagrant_env
|
347
|
-
env.expects(:load!).never
|
348
|
-
env.config
|
349
|
-
end
|
350
|
-
end
|
351
|
-
|
352
|
-
context "accessing the box collection" do
|
353
|
-
should "create a box collection representing the environment" do
|
354
|
-
env = vagrant_env
|
355
|
-
assert env.boxes.is_a?(Vagrant::BoxCollection)
|
356
|
-
assert_equal env, env.boxes.env
|
357
|
-
end
|
358
|
-
|
359
|
-
should "not load the environment if its already loaded" do
|
360
|
-
env = vagrant_env
|
361
|
-
env.expects(:load!).never
|
362
|
-
env.boxes
|
363
|
-
end
|
364
|
-
|
365
|
-
should "return the parent's box collection if it has one" do
|
366
|
-
env = vagrant_env(vagrantfile(<<-vf))
|
367
|
-
config.vm.define :web
|
368
|
-
config.vm.define :db
|
369
|
-
vf
|
370
|
-
|
371
|
-
assert env.vms[:web].env.boxes.equal?(env.boxes)
|
372
|
-
end
|
373
|
-
end
|
374
|
-
|
375
|
-
context "accessing the VMs hash" do
|
376
|
-
should "load the environment if its not already loaded" do
|
377
|
-
env = @klass.new(:cwd => vagrantfile)
|
378
|
-
assert !env.loaded?
|
379
|
-
env.vms
|
380
|
-
assert env.loaded?
|
381
|
-
end
|
382
|
-
|
383
|
-
should "not load the environment if its already loaded" do
|
384
|
-
env = vagrant_env
|
385
|
-
env.expects(:load!).never
|
386
|
-
env.vms
|
387
|
-
end
|
388
|
-
|
389
|
-
should "return the parent's VMs hash if it has one" do
|
390
|
-
env = vagrant_env(vagrantfile(<<-vf))
|
391
|
-
config.vm.define :web
|
392
|
-
config.vm.define :db
|
393
|
-
vf
|
394
|
-
|
395
|
-
assert env.vms[:web].env.vms.equal?(env.vms)
|
396
|
-
end
|
397
|
-
end
|
398
|
-
|
399
|
-
context "loading" do
|
400
|
-
context "overall load method" do
|
401
|
-
should "load! should call proper sequence and return itself" do
|
402
|
-
env = @klass.new(:cwd => vagrantfile)
|
403
|
-
call_seq = sequence("call_sequence")
|
404
|
-
@klass.expects(:check_virtualbox!).once.in_sequence(call_seq)
|
405
|
-
env.expects(:load_config!).once.in_sequence(call_seq)
|
406
|
-
assert_equal env, env.load!
|
407
|
-
end
|
408
|
-
end
|
409
|
-
|
410
|
-
context "loading config" do
|
411
|
-
setup do
|
412
|
-
clean_paths
|
413
|
-
@env = @klass.new(:cwd => vagrantfile)
|
414
|
-
end
|
415
|
-
|
416
|
-
def create_box_vagrantfile
|
417
|
-
vagrantfile(vagrant_box("box"), <<-FILE)
|
418
|
-
config.package.name = "box.box"
|
419
|
-
config.vm.base_mac = "set"
|
420
|
-
FILE
|
421
|
-
end
|
422
|
-
|
423
|
-
def create_home_vagrantfile
|
424
|
-
vagrantfile(home_path, 'config.package.name = "home.box"')
|
425
|
-
end
|
426
|
-
|
427
|
-
def create_root_vagrantfile
|
428
|
-
vagrantfile(@env.root_path, 'config.package.name = "root.box"')
|
429
|
-
end
|
430
|
-
|
431
|
-
should "load from the project root" do
|
432
|
-
assert_equal "package.box", @env.config.package.name
|
433
|
-
end
|
434
|
-
|
435
|
-
should "load from box if specified" do
|
436
|
-
create_box_vagrantfile
|
437
|
-
vagrantfile(@env.root_path, "config.vm.box = 'box'")
|
438
|
-
|
439
|
-
assert_equal "box.box", @env.primary_vm.env.config.package.name
|
440
|
-
end
|
441
|
-
|
442
|
-
should "load from home path if exists" do
|
443
|
-
create_home_vagrantfile
|
444
|
-
assert_equal "home.box", @env.config.package.name
|
445
|
-
end
|
446
|
-
|
447
|
-
should "load from root path" do
|
448
|
-
create_home_vagrantfile
|
449
|
-
create_root_vagrantfile
|
450
|
-
assert_equal "root.box", @env.config.package.name
|
451
|
-
end
|
452
|
-
|
453
|
-
should "load from a sub-vm configuration if environment represents a VM" do
|
454
|
-
create_home_vagrantfile
|
455
|
-
create_box_vagrantfile
|
456
|
-
vagrantfile(@env.root_path, <<-vf)
|
457
|
-
config.package.name = "root.box"
|
458
|
-
config.vm.define :web do |web|
|
459
|
-
web.vm.box = "box"
|
460
|
-
web.package.name = "web.box"
|
461
|
-
end
|
462
|
-
vf
|
463
|
-
|
464
|
-
assert_equal "root.box", @env.config.package.name
|
465
|
-
assert_equal "web.box", @env.vms[:web].env.config.package.name
|
466
|
-
assert_equal "set", @env.vms[:web].env.config.vm.base_mac
|
467
|
-
end
|
468
|
-
|
469
|
-
should "be able to reload config" do
|
470
|
-
vagrantfile(@env.root_path, "config.vm.box = 'box'")
|
471
|
-
|
472
|
-
# First load the config normally
|
473
|
-
@env.load_config!
|
474
|
-
assert_equal "box", @env.config.vm.box
|
475
|
-
assert_not_equal "set", @env.config.vm.base_mac
|
476
|
-
|
477
|
-
# Modify the Vagrantfile and reload it, then verify new results
|
478
|
-
# are available
|
479
|
-
vagrantfile(@env.root_path, "config.vm.base_mac = 'set'")
|
480
|
-
@env.reload_config!
|
481
|
-
assert_equal "set", @env.config.vm.base_mac
|
482
|
-
end
|
483
|
-
end
|
484
|
-
|
485
|
-
context "loading home directory" do
|
486
|
-
setup do
|
487
|
-
@env = vagrant_env
|
488
|
-
|
489
|
-
File.stubs(:directory?).returns(true)
|
490
|
-
FileUtils.stubs(:mkdir_p)
|
491
|
-
end
|
492
|
-
|
493
|
-
should "create each directory if it doesn't exist" do
|
494
|
-
create_seq = sequence("create_seq")
|
495
|
-
File.stubs(:directory?).returns(false)
|
496
|
-
@klass::HOME_SUBDIRS.each do |subdir|
|
497
|
-
FileUtils.expects(:mkdir_p).with(@env.home_path.join(subdir)).in_sequence(create_seq)
|
498
|
-
end
|
499
|
-
|
500
|
-
@env.load_home_directory!
|
501
|
-
end
|
502
|
-
|
503
|
-
should "not create directories if they exist" do
|
504
|
-
File.stubs(:directory?).returns(true)
|
505
|
-
FileUtils.expects(:mkdir_p).never
|
506
|
-
@env.load_home_directory!
|
507
|
-
end
|
508
|
-
end
|
509
|
-
|
510
|
-
context "loading the UUID out from the persisted dotfile" do
|
511
|
-
setup do
|
512
|
-
@env = vagrant_env
|
513
|
-
end
|
514
|
-
|
515
|
-
should "load all the VMs from the dotfile" do
|
516
|
-
@env.local_data[:active] = { "foo" => "bar", "bar" => "baz" }
|
517
|
-
|
518
|
-
results = {}
|
519
|
-
@env.local_data[:active].each do |key, value|
|
520
|
-
vm = mock("vm#{key}")
|
521
|
-
Vagrant::VM.expects(:find).with(value, @env, key.to_sym).returns(vm)
|
522
|
-
results[key.to_sym] = vm
|
523
|
-
end
|
524
|
-
|
525
|
-
returned = @env.load_vms!
|
526
|
-
|
527
|
-
results.each do |key, value|
|
528
|
-
assert_equal value, returned[key]
|
529
|
-
end
|
530
|
-
end
|
531
|
-
|
532
|
-
should "uuid should be nil if local data contains nothing" do
|
533
|
-
assert @env.local_data.empty? # sanity
|
534
|
-
@env.load_vms!
|
535
|
-
assert_nil @env.vm
|
536
|
-
end
|
537
|
-
end
|
538
|
-
end
|
539
|
-
end
|