vagrant-lxc 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +29 -0
- data/.gitmodules +3 -0
- data/.rspec +2 -0
- data/.travis.yml +8 -0
- data/.vimrc +1 -0
- data/Gemfile +19 -0
- data/Gemfile.lock +89 -0
- data/Guardfile +34 -0
- data/LICENSE.txt +22 -0
- data/README.md +209 -0
- data/Rakefile +5 -0
- data/bin/vagrant-lxc +9 -0
- data/boxes/quantal64/download-ubuntu +103 -0
- data/boxes/quantal64/lxc-template +567 -0
- data/boxes/quantal64/metadata.json +9 -0
- data/development/Vagrantfile.1.0 +35 -0
- data/development/Vagrantfile.1.1 +55 -0
- data/development/lxc-configs/lxc-dev-box +37 -0
- data/development/lxc-configs/vbox +37 -0
- data/development/shell-provisioning/upgrade-kernel +14 -0
- data/development/site.pp +125 -0
- data/example/Vagrantfile +42 -0
- data/example/puppet/manifests/site.pp +5 -0
- data/example/puppet/modules/hello_world/manifests/init.pp +3 -0
- data/lib/vagrant-lxc.rb +6 -0
- data/lib/vagrant-lxc/action.rb +188 -0
- data/lib/vagrant-lxc/action/base_action.rb +11 -0
- data/lib/vagrant-lxc/action/boot.rb +55 -0
- data/lib/vagrant-lxc/action/check_created.rb +17 -0
- data/lib/vagrant-lxc/action/check_running.rb +17 -0
- data/lib/vagrant-lxc/action/create.rb +14 -0
- data/lib/vagrant-lxc/action/created.rb +16 -0
- data/lib/vagrant-lxc/action/destroy.rb +14 -0
- data/lib/vagrant-lxc/action/forced_halt.rb +22 -0
- data/lib/vagrant-lxc/action/handle_box_metadata.rb +47 -0
- data/lib/vagrant-lxc/action/is_running.rb +15 -0
- data/lib/vagrant-lxc/action/network.rb +21 -0
- data/lib/vagrant-lxc/action/share_folders.rb +65 -0
- data/lib/vagrant-lxc/config.rb +14 -0
- data/lib/vagrant-lxc/container.rb +170 -0
- data/lib/vagrant-lxc/container/cli.rb +124 -0
- data/lib/vagrant-lxc/errors.rb +12 -0
- data/lib/vagrant-lxc/machine_state.rb +25 -0
- data/lib/vagrant-lxc/plugin.rb +23 -0
- data/lib/vagrant-lxc/provider.rb +74 -0
- data/lib/vagrant-lxc/version.rb +5 -0
- data/lib/vendored_vagrant.rb +9 -0
- data/locales/en.yml +17 -0
- data/spec/fixtures/sample-arp-output +4 -0
- data/spec/fixtures/sample-config +47 -0
- data/spec/spec_helper.rb +32 -0
- data/spec/support/unit_example_group.rb +28 -0
- data/spec/unit/action/handle_box_metadata_spec.rb +44 -0
- data/spec/unit/container/cli_spec.rb +148 -0
- data/spec/unit/container_spec.rb +151 -0
- data/spec/unit/machine_state_spec.rb +39 -0
- data/spec/unit_helper.rb +9 -0
- data/tasks/boxes.rake +17 -0
- data/tasks/spec.rake +30 -0
- data/vagrant-lxc.gemspec +32 -0
- data/vendor/.gitkeep +0 -0
- data/vendor/vagrant/.gitignore +31 -0
- data/vendor/vagrant/.travis.yml +7 -0
- data/vendor/vagrant/.yardopts +1 -0
- data/vendor/vagrant/CHANGELOG.md +803 -0
- data/vendor/vagrant/Gemfile +3 -0
- data/vendor/vagrant/LICENSE +21 -0
- data/vendor/vagrant/README.md +89 -0
- data/vendor/vagrant/Rakefile +18 -0
- data/vendor/vagrant/bin/vagrant +84 -0
- data/vendor/vagrant/config/default.rb +35 -0
- data/vendor/vagrant/contrib/README.md +12 -0
- data/vendor/vagrant/contrib/bash/completion.sh +3 -0
- data/vendor/vagrant/contrib/emacs/vagrant.el +8 -0
- data/vendor/vagrant/contrib/vim/vagrantfile.vim +9 -0
- data/vendor/vagrant/keys/README.md +17 -0
- data/vendor/vagrant/keys/vagrant +27 -0
- data/vendor/vagrant/keys/vagrant.pub +1 -0
- data/vendor/vagrant/lib/vagrant.rb +251 -0
- data/vendor/vagrant/lib/vagrant/action.rb +42 -0
- data/vendor/vagrant/lib/vagrant/action/builder.rb +154 -0
- data/vendor/vagrant/lib/vagrant/action/builtin/box_add.rb +79 -0
- data/vendor/vagrant/lib/vagrant/action/builtin/call.rb +67 -0
- data/vendor/vagrant/lib/vagrant/action/builtin/config_validate.rb +30 -0
- data/vendor/vagrant/lib/vagrant/action/builtin/confirm.rb +38 -0
- data/vendor/vagrant/lib/vagrant/action/builtin/env_set.rb +24 -0
- data/vendor/vagrant/lib/vagrant/action/builtin/graceful_halt.rb +73 -0
- data/vendor/vagrant/lib/vagrant/action/builtin/handle_box_url.rb +43 -0
- data/vendor/vagrant/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb +117 -0
- data/vendor/vagrant/lib/vagrant/action/builtin/lock.rb +57 -0
- data/vendor/vagrant/lib/vagrant/action/builtin/nfs.rb +117 -0
- data/vendor/vagrant/lib/vagrant/action/builtin/provision.rb +70 -0
- data/vendor/vagrant/lib/vagrant/action/builtin/set_hostname.rb +27 -0
- data/vendor/vagrant/lib/vagrant/action/builtin/ssh_exec.rb +42 -0
- data/vendor/vagrant/lib/vagrant/action/builtin/ssh_run.rb +43 -0
- data/vendor/vagrant/lib/vagrant/action/general/package.rb +102 -0
- data/vendor/vagrant/lib/vagrant/action/hook.rb +103 -0
- data/vendor/vagrant/lib/vagrant/action/runner.rb +69 -0
- data/vendor/vagrant/lib/vagrant/action/warden.rb +103 -0
- data/vendor/vagrant/lib/vagrant/box.rb +93 -0
- data/vendor/vagrant/lib/vagrant/box_collection.rb +315 -0
- data/vendor/vagrant/lib/vagrant/cli.rb +82 -0
- data/vendor/vagrant/lib/vagrant/config.rb +63 -0
- data/vendor/vagrant/lib/vagrant/config/container.rb +37 -0
- data/vendor/vagrant/lib/vagrant/config/loader.rb +222 -0
- data/vendor/vagrant/lib/vagrant/config/v1.rb +9 -0
- data/vendor/vagrant/lib/vagrant/config/v1/dummy_config.rb +13 -0
- data/vendor/vagrant/lib/vagrant/config/v1/loader.rb +105 -0
- data/vendor/vagrant/lib/vagrant/config/v1/root.rb +60 -0
- data/vendor/vagrant/lib/vagrant/config/v2.rb +9 -0
- data/vendor/vagrant/lib/vagrant/config/v2/dummy_config.rb +13 -0
- data/vendor/vagrant/lib/vagrant/config/v2/loader.rb +141 -0
- data/vendor/vagrant/lib/vagrant/config/v2/root.rb +105 -0
- data/vendor/vagrant/lib/vagrant/config/v2/util.rb +21 -0
- data/vendor/vagrant/lib/vagrant/config/version_base.rb +80 -0
- data/vendor/vagrant/lib/vagrant/downloaders.rb +7 -0
- data/vendor/vagrant/lib/vagrant/downloaders/base.rb +22 -0
- data/vendor/vagrant/lib/vagrant/downloaders/file.rb +28 -0
- data/vendor/vagrant/lib/vagrant/downloaders/http.rb +116 -0
- data/vendor/vagrant/lib/vagrant/environment.rb +729 -0
- data/vendor/vagrant/lib/vagrant/errors.rb +486 -0
- data/vendor/vagrant/lib/vagrant/hosts.rb +28 -0
- data/vendor/vagrant/lib/vagrant/machine.rb +325 -0
- data/vendor/vagrant/lib/vagrant/machine_state.rb +45 -0
- data/vendor/vagrant/lib/vagrant/plugin.rb +6 -0
- data/vendor/vagrant/lib/vagrant/plugin/v1.rb +19 -0
- data/vendor/vagrant/lib/vagrant/plugin/v1/command.rb +169 -0
- data/vendor/vagrant/lib/vagrant/plugin/v1/communicator.rb +98 -0
- data/vendor/vagrant/lib/vagrant/plugin/v1/config.rb +112 -0
- data/vendor/vagrant/lib/vagrant/plugin/v1/errors.rb +15 -0
- data/vendor/vagrant/lib/vagrant/plugin/v1/guest.rb +92 -0
- data/vendor/vagrant/lib/vagrant/plugin/v1/host.rb +66 -0
- data/vendor/vagrant/lib/vagrant/plugin/v1/manager.rb +131 -0
- data/vendor/vagrant/lib/vagrant/plugin/v1/plugin.rb +229 -0
- data/vendor/vagrant/lib/vagrant/plugin/v1/provider.rb +68 -0
- data/vendor/vagrant/lib/vagrant/plugin/v1/provisioner.rb +50 -0
- data/vendor/vagrant/lib/vagrant/plugin/v2.rb +22 -0
- data/vendor/vagrant/lib/vagrant/plugin/v2/command.rb +234 -0
- data/vendor/vagrant/lib/vagrant/plugin/v2/communicator.rb +98 -0
- data/vendor/vagrant/lib/vagrant/plugin/v2/components.rb +29 -0
- data/vendor/vagrant/lib/vagrant/plugin/v2/config.rb +101 -0
- data/vendor/vagrant/lib/vagrant/plugin/v2/errors.rb +15 -0
- data/vendor/vagrant/lib/vagrant/plugin/v2/guest.rb +92 -0
- data/vendor/vagrant/lib/vagrant/plugin/v2/host.rb +66 -0
- data/vendor/vagrant/lib/vagrant/plugin/v2/manager.rb +158 -0
- data/vendor/vagrant/lib/vagrant/plugin/v2/plugin.rb +217 -0
- data/vendor/vagrant/lib/vagrant/plugin/v2/provider.rb +69 -0
- data/vendor/vagrant/lib/vagrant/plugin/v2/provisioner.rb +47 -0
- data/vendor/vagrant/lib/vagrant/registry.rb +78 -0
- data/vendor/vagrant/lib/vagrant/ssh.rb +132 -0
- data/vendor/vagrant/lib/vagrant/test_helpers.rb +154 -0
- data/vendor/vagrant/lib/vagrant/ui.rb +170 -0
- data/vendor/vagrant/lib/vagrant/util.rb +12 -0
- data/vendor/vagrant/lib/vagrant/util/ansi_escape_code_remover.rb +34 -0
- data/vendor/vagrant/lib/vagrant/util/busy.rb +59 -0
- data/vendor/vagrant/lib/vagrant/util/counter.rb +24 -0
- data/vendor/vagrant/lib/vagrant/util/file_checksum.rb +38 -0
- data/vendor/vagrant/lib/vagrant/util/file_mode.rb +12 -0
- data/vendor/vagrant/lib/vagrant/util/hash_with_indifferent_access.rb +63 -0
- data/vendor/vagrant/lib/vagrant/util/is_port_open.rb +38 -0
- data/vendor/vagrant/lib/vagrant/util/line_ending_helpers.rb +14 -0
- data/vendor/vagrant/lib/vagrant/util/network_ip.rb +28 -0
- data/vendor/vagrant/lib/vagrant/util/platform.rb +68 -0
- data/vendor/vagrant/lib/vagrant/util/retryable.rb +31 -0
- data/vendor/vagrant/lib/vagrant/util/safe_exec.rb +36 -0
- data/vendor/vagrant/lib/vagrant/util/safe_puts.rb +31 -0
- data/vendor/vagrant/lib/vagrant/util/scoped_hash_override.rb +45 -0
- data/vendor/vagrant/lib/vagrant/util/ssh.rb +126 -0
- data/vendor/vagrant/lib/vagrant/util/stacked_proc_runner.rb +35 -0
- data/vendor/vagrant/lib/vagrant/util/string_block_editor.rb +75 -0
- data/vendor/vagrant/lib/vagrant/util/subprocess.rb +270 -0
- data/vendor/vagrant/lib/vagrant/util/template_renderer.rb +83 -0
- data/vendor/vagrant/lib/vagrant/util/which.rb +43 -0
- data/vendor/vagrant/lib/vagrant/version.rb +6 -0
- data/vendor/vagrant/plugins/README.md +5 -0
- data/vendor/vagrant/plugins/commands/box/command/add.rb +52 -0
- data/vendor/vagrant/plugins/commands/box/command/list.rb +41 -0
- data/vendor/vagrant/plugins/commands/box/command/remove.rb +37 -0
- data/vendor/vagrant/plugins/commands/box/command/repackage.rb +43 -0
- data/vendor/vagrant/plugins/commands/box/command/root.rb +75 -0
- data/vendor/vagrant/plugins/commands/box/plugin.rb +15 -0
- data/vendor/vagrant/plugins/commands/destroy/command.rb +31 -0
- data/vendor/vagrant/plugins/commands/destroy/plugin.rb +18 -0
- data/vendor/vagrant/plugins/commands/halt/command.rb +33 -0
- data/vendor/vagrant/plugins/commands/halt/plugin.rb +18 -0
- data/vendor/vagrant/plugins/commands/init/command.rb +40 -0
- data/vendor/vagrant/plugins/commands/init/plugin.rb +18 -0
- data/vendor/vagrant/plugins/commands/package/command.rb +78 -0
- data/vendor/vagrant/plugins/commands/package/plugin.rb +18 -0
- data/vendor/vagrant/plugins/commands/plugin/action.rb +52 -0
- data/vendor/vagrant/plugins/commands/plugin/action/bundler_check.rb +25 -0
- data/vendor/vagrant/plugins/commands/plugin/action/install_gem.rb +70 -0
- data/vendor/vagrant/plugins/commands/plugin/action/license_plugin.rb +54 -0
- data/vendor/vagrant/plugins/commands/plugin/action/list_plugins.rb +54 -0
- data/vendor/vagrant/plugins/commands/plugin/action/prune_gems.rb +149 -0
- data/vendor/vagrant/plugins/commands/plugin/action/uninstall_plugin.rb +23 -0
- data/vendor/vagrant/plugins/commands/plugin/command/base.rb +22 -0
- data/vendor/vagrant/plugins/commands/plugin/command/install.rb +39 -0
- data/vendor/vagrant/plugins/commands/plugin/command/license.rb +31 -0
- data/vendor/vagrant/plugins/commands/plugin/command/list.rb +28 -0
- data/vendor/vagrant/plugins/commands/plugin/command/root.rb +75 -0
- data/vendor/vagrant/plugins/commands/plugin/command/uninstall.rb +28 -0
- data/vendor/vagrant/plugins/commands/plugin/gem_helper.rb +74 -0
- data/vendor/vagrant/plugins/commands/plugin/plugin.rb +22 -0
- data/vendor/vagrant/plugins/commands/plugin/state_file.rb +57 -0
- data/vendor/vagrant/plugins/commands/provision/command.rb +34 -0
- data/vendor/vagrant/plugins/commands/provision/plugin.rb +18 -0
- data/vendor/vagrant/plugins/commands/reload/command.rb +37 -0
- data/vendor/vagrant/plugins/commands/reload/plugin.rb +18 -0
- data/vendor/vagrant/plugins/commands/resume/command.rb +25 -0
- data/vendor/vagrant/plugins/commands/resume/plugin.rb +17 -0
- data/vendor/vagrant/plugins/commands/ssh/command.rb +66 -0
- data/vendor/vagrant/plugins/commands/ssh/plugin.rb +17 -0
- data/vendor/vagrant/plugins/commands/ssh_config/command.rb +49 -0
- data/vendor/vagrant/plugins/commands/ssh_config/plugin.rb +18 -0
- data/vendor/vagrant/plugins/commands/status/command.rb +39 -0
- data/vendor/vagrant/plugins/commands/status/plugin.rb +18 -0
- data/vendor/vagrant/plugins/commands/suspend/command.rb +25 -0
- data/vendor/vagrant/plugins/commands/suspend/plugin.rb +18 -0
- data/vendor/vagrant/plugins/commands/up/command.rb +45 -0
- data/vendor/vagrant/plugins/commands/up/plugin.rb +17 -0
- data/vendor/vagrant/plugins/commands/up/start_mixins.rb +26 -0
- data/vendor/vagrant/plugins/communicators/ssh/communicator.rb +317 -0
- data/vendor/vagrant/plugins/communicators/ssh/plugin.rb +19 -0
- data/vendor/vagrant/plugins/guests/arch/guest.rb +41 -0
- data/vendor/vagrant/plugins/guests/arch/plugin.rb +15 -0
- data/vendor/vagrant/plugins/guests/debian/guest.rb +72 -0
- data/vendor/vagrant/plugins/guests/debian/plugin.rb +15 -0
- data/vendor/vagrant/plugins/guests/fedora/guest.rb +71 -0
- data/vendor/vagrant/plugins/guests/fedora/plugin.rb +15 -0
- data/vendor/vagrant/plugins/guests/freebsd/config.rb +13 -0
- data/vendor/vagrant/plugins/guests/freebsd/guest.rb +70 -0
- data/vendor/vagrant/plugins/guests/freebsd/plugin.rb +20 -0
- data/vendor/vagrant/plugins/guests/gentoo/guest.rb +51 -0
- data/vendor/vagrant/plugins/guests/gentoo/plugin.rb +15 -0
- data/vendor/vagrant/plugins/guests/linux/config.rb +13 -0
- data/vendor/vagrant/plugins/guests/linux/guest.rb +118 -0
- data/vendor/vagrant/plugins/guests/linux/plugin.rb +20 -0
- data/vendor/vagrant/plugins/guests/openbsd/guest.rb +13 -0
- data/vendor/vagrant/plugins/guests/openbsd/plugin.rb +15 -0
- data/vendor/vagrant/plugins/guests/redhat/guest.rb +74 -0
- data/vendor/vagrant/plugins/guests/redhat/plugin.rb +15 -0
- data/vendor/vagrant/plugins/guests/solaris/config.rb +18 -0
- data/vendor/vagrant/plugins/guests/solaris/guest.rb +73 -0
- data/vendor/vagrant/plugins/guests/solaris/plugin.rb +20 -0
- data/vendor/vagrant/plugins/guests/suse/guest.rb +24 -0
- data/vendor/vagrant/plugins/guests/suse/plugin.rb +15 -0
- data/vendor/vagrant/plugins/guests/ubuntu/guest.rb +44 -0
- data/vendor/vagrant/plugins/guests/ubuntu/plugin.rb +15 -0
- data/vendor/vagrant/plugins/hosts/arch/host.rb +68 -0
- data/vendor/vagrant/plugins/hosts/arch/plugin.rb +15 -0
- data/vendor/vagrant/plugins/hosts/bsd/host.rb +102 -0
- data/vendor/vagrant/plugins/hosts/bsd/plugin.rb +15 -0
- data/vendor/vagrant/plugins/hosts/fedora/host.rb +51 -0
- data/vendor/vagrant/plugins/hosts/fedora/plugin.rb +15 -0
- data/vendor/vagrant/plugins/hosts/freebsd/host.rb +43 -0
- data/vendor/vagrant/plugins/hosts/freebsd/plugin.rb +15 -0
- data/vendor/vagrant/plugins/hosts/gentoo/host.rb +24 -0
- data/vendor/vagrant/plugins/hosts/gentoo/plugin.rb +15 -0
- data/vendor/vagrant/plugins/hosts/linux/host.rb +95 -0
- data/vendor/vagrant/plugins/hosts/linux/plugin.rb +15 -0
- data/vendor/vagrant/plugins/hosts/opensuse/host.rb +34 -0
- data/vendor/vagrant/plugins/hosts/opensuse/plugin.rb +15 -0
- data/vendor/vagrant/plugins/hosts/windows/host.rb +17 -0
- data/vendor/vagrant/plugins/hosts/windows/plugin.rb +15 -0
- data/vendor/vagrant/plugins/kernel_v1/config/nfs.rb +20 -0
- data/vendor/vagrant/plugins/kernel_v1/config/package.rb +17 -0
- data/vendor/vagrant/plugins/kernel_v1/config/ssh.rb +46 -0
- data/vendor/vagrant/plugins/kernel_v1/config/vagrant.rb +31 -0
- data/vendor/vagrant/plugins/kernel_v1/config/vm.rb +184 -0
- data/vendor/vagrant/plugins/kernel_v1/plugin.rb +44 -0
- data/vendor/vagrant/plugins/kernel_v2/config/nfs.rb +10 -0
- data/vendor/vagrant/plugins/kernel_v2/config/package.rb +9 -0
- data/vendor/vagrant/plugins/kernel_v2/config/ssh.rb +35 -0
- data/vendor/vagrant/plugins/kernel_v2/config/vagrant.rb +9 -0
- data/vendor/vagrant/plugins/kernel_v2/config/vm.rb +314 -0
- data/vendor/vagrant/plugins/kernel_v2/config/vm_provisioner.rb +40 -0
- data/vendor/vagrant/plugins/kernel_v2/config/vm_subvm.rb +30 -0
- data/vendor/vagrant/plugins/kernel_v2/plugin.rb +44 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action.rb +308 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/boot.rb +49 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/check_accessible.rb +23 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/check_created.rb +21 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/check_guest_additions.rb +45 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/check_running.rb +21 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/check_virtualbox.rb +22 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/clean_machine_folder.rb +43 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/clear_forwarded_ports.rb +18 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/clear_network_interfaces.rb +31 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/clear_shared_folders.rb +17 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/created.rb +20 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/customize.rb +36 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/destroy.rb +19 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/destroy_confirm.rb +17 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/destroy_unused_network_interfaces.rb +16 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/discard_state.rb +20 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/export.rb +57 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/forced_halt.rb +25 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/forward_ports.rb +79 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/import.rb +51 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/is_paused.rb +20 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/is_running.rb +20 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/is_saved.rb +20 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/match_mac_address.rb +21 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/message_not_created.rb +16 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/message_not_running.rb +16 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/message_will_not_destroy.rb +17 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/network.rb +366 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/package.rb +20 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/package_vagrantfile.rb +33 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/prepare_forwarded_port_collision_params.rb +35 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/prepare_nfs_settings.rb +51 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/prune_nfs_exports.rb +20 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/resume.rb +25 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/sane_defaults.rb +87 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/set_name.rb +40 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/setup_package_files.rb +51 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/share_folders.rb +113 -0
- data/vendor/vagrant/plugins/providers/virtualbox/action/suspend.rb +20 -0
- data/vendor/vagrant/plugins/providers/virtualbox/config.rb +82 -0
- data/vendor/vagrant/plugins/providers/virtualbox/driver/base.rb +344 -0
- data/vendor/vagrant/plugins/providers/virtualbox/driver/meta.rb +141 -0
- data/vendor/vagrant/plugins/providers/virtualbox/driver/version_4_0.rb +481 -0
- data/vendor/vagrant/plugins/providers/virtualbox/driver/version_4_1.rb +481 -0
- data/vendor/vagrant/plugins/providers/virtualbox/driver/version_4_2.rb +471 -0
- data/vendor/vagrant/plugins/providers/virtualbox/model/forwarded_port.rb +58 -0
- data/vendor/vagrant/plugins/providers/virtualbox/plugin.rb +42 -0
- data/vendor/vagrant/plugins/providers/virtualbox/provider.rb +92 -0
- data/vendor/vagrant/plugins/providers/virtualbox/util/compile_forwarded_ports.rb +31 -0
- data/vendor/vagrant/plugins/provisioners/chef/config/base.rb +65 -0
- data/vendor/vagrant/plugins/provisioners/chef/config/chef_client.rb +39 -0
- data/vendor/vagrant/plugins/provisioners/chef/config/chef_solo.rb +87 -0
- data/vendor/vagrant/plugins/provisioners/chef/plugin.rb +33 -0
- data/vendor/vagrant/plugins/provisioners/chef/provisioner/base.rb +91 -0
- data/vendor/vagrant/plugins/provisioners/chef/provisioner/chef_client.rb +103 -0
- data/vendor/vagrant/plugins/provisioners/chef/provisioner/chef_solo.rb +182 -0
- data/vendor/vagrant/plugins/provisioners/puppet/config/puppet.rb +70 -0
- data/vendor/vagrant/plugins/provisioners/puppet/config/puppet_server.rb +16 -0
- data/vendor/vagrant/plugins/provisioners/puppet/plugin.rb +33 -0
- data/vendor/vagrant/plugins/provisioners/puppet/provisioner/puppet.rb +110 -0
- data/vendor/vagrant/plugins/provisioners/puppet/provisioner/puppet_server.rb +67 -0
- data/vendor/vagrant/plugins/provisioners/shell/config.rb +46 -0
- data/vendor/vagrant/plugins/provisioners/shell/plugin.rb +23 -0
- data/vendor/vagrant/plugins/provisioners/shell/provisioner.rb +66 -0
- data/vendor/vagrant/tasks/acceptance.rake +113 -0
- data/vendor/vagrant/tasks/bundler.rake +3 -0
- data/vendor/vagrant/tasks/test.rake +20 -0
- data/vendor/vagrant/templates/commands/init/Vagrantfile.erb +111 -0
- data/vendor/vagrant/templates/commands/ssh_config/config.erb +16 -0
- data/vendor/vagrant/templates/config/messages.erb +14 -0
- data/vendor/vagrant/templates/config/validation_failed.erb +7 -0
- data/vendor/vagrant/templates/guests/arch/network_dhcp.erb +4 -0
- data/vendor/vagrant/templates/guests/arch/network_static.erb +6 -0
- data/vendor/vagrant/templates/guests/debian/network_dhcp.erb +11 -0
- data/vendor/vagrant/templates/guests/debian/network_static.erb +7 -0
- data/vendor/vagrant/templates/guests/fedora/network_dhcp.erb +6 -0
- data/vendor/vagrant/templates/guests/fedora/network_static.erb +13 -0
- data/vendor/vagrant/templates/guests/freebsd/network_dhcp.erb +3 -0
- data/vendor/vagrant/templates/guests/freebsd/network_static.erb +3 -0
- data/vendor/vagrant/templates/guests/gentoo/network_dhcp.erb +4 -0
- data/vendor/vagrant/templates/guests/gentoo/network_static.erb +4 -0
- data/vendor/vagrant/templates/guests/redhat/network_dhcp.erb +6 -0
- data/vendor/vagrant/templates/guests/redhat/network_static.erb +7 -0
- data/vendor/vagrant/templates/locales/en.yml +993 -0
- data/vendor/vagrant/templates/nfs/exports.erb +5 -0
- data/vendor/vagrant/templates/nfs/exports_freebsd.erb +5 -0
- data/vendor/vagrant/templates/nfs/exports_linux.erb +5 -0
- data/vendor/vagrant/templates/package_Vagrantfile.erb +11 -0
- data/vendor/vagrant/templates/provisioners/chef_client/client.erb +32 -0
- data/vendor/vagrant/templates/provisioners/chef_solo/solo.erb +25 -0
- data/vendor/vagrant/templates/rgloader.rb +9 -0
- data/vendor/vagrant/test/acceptance/base.rb +48 -0
- data/vendor/vagrant/test/acceptance/box_test.rb +99 -0
- data/vendor/vagrant/test/acceptance/destroy_test.rb +37 -0
- data/vendor/vagrant/test/acceptance/halt_test.rb +72 -0
- data/vendor/vagrant/test/acceptance/init_test.rb +33 -0
- data/vendor/vagrant/test/acceptance/networking/host_only_test.rb +37 -0
- data/vendor/vagrant/test/acceptance/networking/port_forward_test.rb +125 -0
- data/vendor/vagrant/test/acceptance/package_test.rb +46 -0
- data/vendor/vagrant/test/acceptance/provisioning/basic_test.rb +61 -0
- data/vendor/vagrant/test/acceptance/provisioning/chef_solo_test.rb +37 -0
- data/vendor/vagrant/test/acceptance/provisioning/shell_test.rb +53 -0
- data/vendor/vagrant/test/acceptance/resume_test.rb +17 -0
- data/vendor/vagrant/test/acceptance/shared_folders_test.rb +84 -0
- data/vendor/vagrant/test/acceptance/skeletons/chef_solo_basic/README.md +3 -0
- data/vendor/vagrant/test/acceptance/skeletons/chef_solo_basic/cookbooks/basic/recipes/default.rb +5 -0
- data/vendor/vagrant/test/acceptance/skeletons/chef_solo_json/README.md +3 -0
- data/vendor/vagrant/test/acceptance/skeletons/chef_solo_json/cookbooks/basic/recipes/default.rb +6 -0
- data/vendor/vagrant/test/acceptance/skeletons/provisioner_multi/README.md +3 -0
- data/vendor/vagrant/test/acceptance/skeletons/provisioner_multi/cookbooks/basic/recipes/default.rb +5 -0
- data/vendor/vagrant/test/acceptance/ssh_test.rb +46 -0
- data/vendor/vagrant/test/acceptance/support/config.rb +42 -0
- data/vendor/vagrant/test/acceptance/support/isolated_environment.rb +118 -0
- data/vendor/vagrant/test/acceptance/support/matchers/have_color.rb +9 -0
- data/vendor/vagrant/test/acceptance/support/matchers/match_output.rb +14 -0
- data/vendor/vagrant/test/acceptance/support/matchers/succeed.rb +14 -0
- data/vendor/vagrant/test/acceptance/support/network_tests.rb +29 -0
- data/vendor/vagrant/test/acceptance/support/output.rb +95 -0
- data/vendor/vagrant/test/acceptance/support/shared/base_context.rb +72 -0
- data/vendor/vagrant/test/acceptance/support/shared/command_examples.rb +33 -0
- data/vendor/vagrant/test/acceptance/support/virtualbox.rb +36 -0
- data/vendor/vagrant/test/acceptance/suspend_test.rb +56 -0
- data/vendor/vagrant/test/acceptance/up_basic_test.rb +33 -0
- data/vendor/vagrant/test/acceptance/up_with_box_url.rb +40 -0
- data/vendor/vagrant/test/acceptance/vagrant_test.rb +47 -0
- data/vendor/vagrant/test/acceptance/version_test.rb +15 -0
- data/vendor/vagrant/test/config/acceptance_boxes.yml +7 -0
- data/vendor/vagrant/test/support/isolated_environment.rb +46 -0
- data/vendor/vagrant/test/support/tempdir.rb +43 -0
- data/vendor/vagrant/test/unit/base.rb +27 -0
- data/vendor/vagrant/test/unit/support/dummy_provider.rb +16 -0
- data/vendor/vagrant/test/unit/support/isolated_environment.rb +177 -0
- data/vendor/vagrant/test/unit/support/shared/base_context.rb +104 -0
- data/vendor/vagrant/test/unit/vagrant/action/builder_test.rb +196 -0
- data/vendor/vagrant/test/unit/vagrant/action/builtin/call_test.rb +145 -0
- data/vendor/vagrant/test/unit/vagrant/action/builtin/confirm_test.rb +36 -0
- data/vendor/vagrant/test/unit/vagrant/action/builtin/env_set_test.rb +20 -0
- data/vendor/vagrant/test/unit/vagrant/action/builtin/graceful_halt_test.rb +61 -0
- data/vendor/vagrant/test/unit/vagrant/action/builtin/lock_test.rb +98 -0
- data/vendor/vagrant/test/unit/vagrant/action/builtin/ssh_exec_test.rb +57 -0
- data/vendor/vagrant/test/unit/vagrant/action/hook_test.rb +101 -0
- data/vendor/vagrant/test/unit/vagrant/action/runner_test.rb +71 -0
- data/vendor/vagrant/test/unit/vagrant/action/warden_test.rb +92 -0
- data/vendor/vagrant/test/unit/vagrant/box_collection_test.rb +224 -0
- data/vendor/vagrant/test/unit/vagrant/box_test.rb +109 -0
- data/vendor/vagrant/test/unit/vagrant/cli_test.rb +27 -0
- data/vendor/vagrant/test/unit/vagrant/config/loader_test.rb +184 -0
- data/vendor/vagrant/test/unit/vagrant/config/v1/dummy_config_test.rb +24 -0
- data/vendor/vagrant/test/unit/vagrant/config/v1/loader_test.rb +145 -0
- data/vendor/vagrant/test/unit/vagrant/config/v1/root_test.rb +40 -0
- data/vendor/vagrant/test/unit/vagrant/config/v2/dummy_config_test.rb +24 -0
- data/vendor/vagrant/test/unit/vagrant/config/v2/loader_test.rb +151 -0
- data/vendor/vagrant/test/unit/vagrant/config/v2/root_test.rb +97 -0
- data/vendor/vagrant/test/unit/vagrant/config/v2/util_test.rb +21 -0
- data/vendor/vagrant/test/unit/vagrant/config_test.rb +66 -0
- data/vendor/vagrant/test/unit/vagrant/downloaders/base_test.rb +14 -0
- data/vendor/vagrant/test/unit/vagrant/downloaders/file_test.rb +87 -0
- data/vendor/vagrant/test/unit/vagrant/downloaders/http_test.rb +23 -0
- data/vendor/vagrant/test/unit/vagrant/environment_test.rb +571 -0
- data/vendor/vagrant/test/unit/vagrant/hosts_test.rb +37 -0
- data/vendor/vagrant/test/unit/vagrant/machine_state_test.rb +26 -0
- data/vendor/vagrant/test/unit/vagrant/machine_test.rb +418 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v1/command_test.rb +143 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v1/communicator_test.rb +9 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v1/config_test.rb +50 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v1/host_test.rb +5 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v1/manager_test.rb +114 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v1/plugin_test.rb +267 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v1/provider_test.rb +18 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v2/command_test.rb +238 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v2/communicator_test.rb +9 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v2/components_test.rb +17 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v2/config_test.rb +60 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v2/host_test.rb +5 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v2/manager_test.rb +157 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v2/plugin_test.rb +287 -0
- data/vendor/vagrant/test/unit/vagrant/plugin/v2/provider_test.rb +18 -0
- data/vendor/vagrant/test/unit/vagrant/registry_test.rb +128 -0
- data/vendor/vagrant/test/unit/vagrant/util/ansi_escape_code_remover_test.rb +16 -0
- data/vendor/vagrant/test/unit/vagrant/util/file_checksum_test.rb +23 -0
- data/vendor/vagrant/test/unit/vagrant/util/hash_with_indifferent_access_test.rb +38 -0
- data/vendor/vagrant/test/unit/vagrant/util/is_port_open_test.rb +53 -0
- data/vendor/vagrant/test/unit/vagrant/util/line_endings_helper_test.rb +16 -0
- data/vendor/vagrant/test/unit/vagrant/util/network_ip_test.rb +17 -0
- data/vendor/vagrant/test/unit/vagrant/util/retryable_test.rb +106 -0
- data/vendor/vagrant/test/unit/vagrant/util/scoped_hash_override_test.rb +48 -0
- data/vendor/vagrant/test/unit/vagrant/util/ssh_test.rb +30 -0
- data/vendor/vagrant/test/unit/vagrant/util/string_block_editor_test.rb +98 -0
- data/vendor/vagrant/test/unit/vagrant/util/which_test.rb +43 -0
- data/vendor/vagrant/test/unit/vagrant_test.rb +56 -0
- data/vendor/vagrant/vagrant.gemspec +69 -0
- metadata +642 -0
@@ -0,0 +1,98 @@
|
|
1
|
+
require File.expand_path("../../../../base", __FILE__)
|
2
|
+
|
3
|
+
describe Vagrant::Action::Builtin::Lock do
|
4
|
+
let(:app) { lambda { |env| } }
|
5
|
+
let(:env) { {} }
|
6
|
+
let(:lock_path) do
|
7
|
+
@__lock_path = Tempfile.new("vagrant-test-lock")
|
8
|
+
@__lock_path.path.to_s
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:options) do
|
12
|
+
{
|
13
|
+
:exception => Class.new(StandardError),
|
14
|
+
:path => lock_path
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should require a path" do
|
19
|
+
expect { described_class.new(app, env) }.
|
20
|
+
to raise_error(ArgumentError)
|
21
|
+
|
22
|
+
expect { described_class.new(app, env, :path => "foo") }.
|
23
|
+
to raise_error(ArgumentError)
|
24
|
+
|
25
|
+
expect { described_class.new(app, env, :exception => "foo") }.
|
26
|
+
to raise_error(ArgumentError)
|
27
|
+
|
28
|
+
expect { described_class.new(app, env, :path => "bar", :exception => "foo") }.
|
29
|
+
to_not raise_error
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should allow the path to be a proc" do
|
33
|
+
inner_acquire = true
|
34
|
+
app = lambda do |env|
|
35
|
+
File.open(lock_path, "w+") do |f|
|
36
|
+
inner_acquire = f.flock(File::LOCK_EX | File::LOCK_NB)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
options[:path] = lambda { |env| lock_path }
|
41
|
+
|
42
|
+
instance = described_class.new(app, env, options)
|
43
|
+
instance.call(env)
|
44
|
+
|
45
|
+
inner_acquire.should == false
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should allow the exception to be a proc" do
|
49
|
+
exception = options[:exception]
|
50
|
+
options[:exception] = lambda { |env| exception }
|
51
|
+
|
52
|
+
File.open(lock_path, "w+") do |f|
|
53
|
+
# Acquire lock
|
54
|
+
f.flock(File::LOCK_EX | File::LOCK_NB).should == 0
|
55
|
+
|
56
|
+
# Test!
|
57
|
+
instance = described_class.new(app, env, options)
|
58
|
+
expect { instance.call(env) }.
|
59
|
+
to raise_error(exception)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should call the middleware with the lock held" do
|
64
|
+
inner_acquire = true
|
65
|
+
app = lambda do |env|
|
66
|
+
File.open(lock_path, "w+") do |f|
|
67
|
+
inner_acquire = f.flock(File::LOCK_EX | File::LOCK_NB)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
instance = described_class.new(app, env, options)
|
72
|
+
instance.call(env)
|
73
|
+
|
74
|
+
inner_acquire.should == false
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should raise an exception if the lock is already held" do
|
78
|
+
File.open(lock_path, "w+") do |f|
|
79
|
+
# Acquire lock
|
80
|
+
f.flock(File::LOCK_EX | File::LOCK_NB).should == 0
|
81
|
+
|
82
|
+
# Test!
|
83
|
+
instance = described_class.new(app, env, options)
|
84
|
+
expect { instance.call(env) }.
|
85
|
+
to raise_error(options[:exception])
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
it "should allow nesting locks within the same middleware sequence" do
|
90
|
+
called = false
|
91
|
+
app = lambda { |env| called = true }
|
92
|
+
inner = described_class.new(app, env, options)
|
93
|
+
outer = described_class.new(inner, env, options)
|
94
|
+
outer.call(env)
|
95
|
+
|
96
|
+
called.should == true
|
97
|
+
end
|
98
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require File.expand_path("../../../../base", __FILE__)
|
2
|
+
|
3
|
+
require "vagrant/util/ssh"
|
4
|
+
|
5
|
+
describe Vagrant::Action::Builtin::SSHExec do
|
6
|
+
let(:app) { lambda { |env| } }
|
7
|
+
let(:env) { { :machine => machine } }
|
8
|
+
let(:machine) do
|
9
|
+
result = double("machine")
|
10
|
+
result.stub(:ssh_info).and_return(machine_ssh_info)
|
11
|
+
result
|
12
|
+
end
|
13
|
+
let(:machine_ssh_info) { {} }
|
14
|
+
let(:ssh_klass) { Vagrant::Util::SSH }
|
15
|
+
|
16
|
+
before(:each) do
|
17
|
+
# Stub the methods so that even if we test incorrectly, no side
|
18
|
+
# effects actually happen.
|
19
|
+
ssh_klass.stub(:check_key_permissions)
|
20
|
+
ssh_klass.stub(:exec)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should raise an exception if SSH is not ready" do
|
24
|
+
not_ready_machine = double("machine")
|
25
|
+
not_ready_machine.stub(:ssh_info).and_return(nil)
|
26
|
+
|
27
|
+
env[:machine] = not_ready_machine
|
28
|
+
expect { described_class.new(app, env).call(env) }.
|
29
|
+
to raise_error(Vagrant::Errors::SSHNotReady)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should check key permissions then exec" do
|
33
|
+
machine_ssh_info[:private_key_path] = "/foo"
|
34
|
+
|
35
|
+
ssh_klass.should_receive(:check_key_permissions).
|
36
|
+
with(Pathname.new(machine_ssh_info[:private_key_path])).
|
37
|
+
once.
|
38
|
+
ordered
|
39
|
+
|
40
|
+
ssh_klass.should_receive(:exec).
|
41
|
+
with(machine_ssh_info, nil).
|
42
|
+
once.
|
43
|
+
ordered
|
44
|
+
|
45
|
+
described_class.new(app, env).call(env)
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should exec with the options given in `ssh_opts`" do
|
49
|
+
ssh_opts = { :foo => :bar }
|
50
|
+
|
51
|
+
ssh_klass.should_receive(:exec).
|
52
|
+
with(machine_ssh_info, ssh_opts)
|
53
|
+
|
54
|
+
env[:ssh_opts] = ssh_opts
|
55
|
+
described_class.new(app, env).call(env)
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
require File.expand_path("../../../base", __FILE__)
|
2
|
+
|
3
|
+
require "vagrant/action/builder"
|
4
|
+
require "vagrant/action/hook"
|
5
|
+
|
6
|
+
describe Vagrant::Action::Hook do
|
7
|
+
describe "defaults" do
|
8
|
+
its("after_hooks") { should be_empty }
|
9
|
+
its("before_hooks") { should be_empty }
|
10
|
+
its("append_hooks") { should be_empty }
|
11
|
+
its("prepend_hooks") { should be_empty }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "before hooks" do
|
15
|
+
let(:existing) { "foo" }
|
16
|
+
|
17
|
+
it "should append them" do
|
18
|
+
block = Proc.new {}
|
19
|
+
|
20
|
+
subject.before(existing, 1)
|
21
|
+
subject.before(existing, 2)
|
22
|
+
subject.before(existing, 3, :arg, &block)
|
23
|
+
|
24
|
+
subject.before_hooks[existing].should == [
|
25
|
+
[1, [], nil],
|
26
|
+
[2, [], nil],
|
27
|
+
[3, [:arg], block]
|
28
|
+
]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "after hooks" do
|
33
|
+
let(:existing) { "foo" }
|
34
|
+
|
35
|
+
it "should append them" do
|
36
|
+
block = Proc.new {}
|
37
|
+
|
38
|
+
subject.after(existing, 1)
|
39
|
+
subject.after(existing, 2)
|
40
|
+
subject.after(existing, 3, :arg, &block)
|
41
|
+
|
42
|
+
subject.after_hooks[existing].should == [
|
43
|
+
[1, [], nil],
|
44
|
+
[2, [], nil],
|
45
|
+
[3, [:arg], block]
|
46
|
+
]
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "append" do
|
51
|
+
it "should make a list" do
|
52
|
+
block = Proc.new {}
|
53
|
+
|
54
|
+
subject.append(1)
|
55
|
+
subject.append(2)
|
56
|
+
subject.append(3, :arg, &block)
|
57
|
+
|
58
|
+
subject.append_hooks.should == [
|
59
|
+
[1, [], nil],
|
60
|
+
[2, [], nil],
|
61
|
+
[3, [:arg], block]
|
62
|
+
]
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe "prepend" do
|
67
|
+
it "should make a list" do
|
68
|
+
block = Proc.new {}
|
69
|
+
|
70
|
+
subject.prepend(1)
|
71
|
+
subject.prepend(2)
|
72
|
+
subject.prepend(3, :arg, &block)
|
73
|
+
|
74
|
+
subject.prepend_hooks.should == [
|
75
|
+
[1, [], nil],
|
76
|
+
[2, [], nil],
|
77
|
+
[3, [:arg], block]
|
78
|
+
]
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe "applying" do
|
83
|
+
let(:builder) { Vagrant::Action::Builder.new }
|
84
|
+
|
85
|
+
it "should build the proper stack" do
|
86
|
+
subject.prepend("1", 2)
|
87
|
+
subject.append("9")
|
88
|
+
subject.after("1", "2")
|
89
|
+
subject.before("9", "8")
|
90
|
+
|
91
|
+
subject.apply(builder)
|
92
|
+
|
93
|
+
builder.stack.should == [
|
94
|
+
["1", [2], nil],
|
95
|
+
["2", [], nil],
|
96
|
+
["8", [], nil],
|
97
|
+
["9", [], nil]
|
98
|
+
]
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require File.expand_path("../../../base", __FILE__)
|
2
|
+
|
3
|
+
describe Vagrant::Action::Runner do
|
4
|
+
let(:instance) { described_class.new }
|
5
|
+
|
6
|
+
it "should raise an error if an invalid callable is given" do
|
7
|
+
expect { instance.run(7) }.to raise_error(ArgumentError, /must be a callable/)
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should be able to use a Proc as a callable" do
|
11
|
+
callable = Proc.new { raise Exception, "BOOM" }
|
12
|
+
expect { instance.run(callable) }.to raise_error(Exception, "BOOM")
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should be able to use a Class as a callable" do
|
16
|
+
callable = Class.new do
|
17
|
+
def initialize(app, env)
|
18
|
+
end
|
19
|
+
|
20
|
+
def call(env)
|
21
|
+
raise Exception, "BOOM"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
expect { instance.run(callable) }.to raise_error(Exception, "BOOM")
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should return the resulting environment" do
|
29
|
+
callable = lambda do |env|
|
30
|
+
env[:data] = "value"
|
31
|
+
|
32
|
+
# Return nil so we can make sure it isn't using this return value
|
33
|
+
nil
|
34
|
+
end
|
35
|
+
|
36
|
+
result = instance.run(callable)
|
37
|
+
result[:data].should == "value"
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should pass options into hash given to callable" do
|
41
|
+
result = nil
|
42
|
+
callable = lambda do |env|
|
43
|
+
result = env["data"]
|
44
|
+
end
|
45
|
+
|
46
|
+
instance.run(callable, "data" => "foo")
|
47
|
+
result.should == "foo"
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should pass global options into the hash" do
|
51
|
+
result = nil
|
52
|
+
callable = lambda do |env|
|
53
|
+
result = env["data"]
|
54
|
+
end
|
55
|
+
|
56
|
+
instance = described_class.new("data" => "bar")
|
57
|
+
instance.run(callable)
|
58
|
+
result.should == "bar"
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should yield the block passed to the init method to get lazy loaded globals" do
|
62
|
+
result = nil
|
63
|
+
callable = lambda do |env|
|
64
|
+
result = env["data"]
|
65
|
+
end
|
66
|
+
|
67
|
+
instance = described_class.new { { "data" => "bar" } }
|
68
|
+
instance.run(callable)
|
69
|
+
result.should == "bar"
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require File.expand_path("../../../base", __FILE__)
|
2
|
+
|
3
|
+
describe Vagrant::Action::Warden do
|
4
|
+
let(:data) { { :data => [] } }
|
5
|
+
let(:instance) { described_class.new }
|
6
|
+
|
7
|
+
# This returns a proc that can be used with the builder
|
8
|
+
# that simply appends data to an array in the env.
|
9
|
+
def appender_proc(data)
|
10
|
+
Proc.new { |env| env[:data] << data }
|
11
|
+
end
|
12
|
+
|
13
|
+
it "calls the actions like normal" do
|
14
|
+
instance = described_class.new([appender_proc(1), appender_proc(2)], data)
|
15
|
+
instance.call(data)
|
16
|
+
|
17
|
+
data[:data].should == [1, 2]
|
18
|
+
end
|
19
|
+
|
20
|
+
it "starts a recovery sequence when an exception is raised" do
|
21
|
+
class Action
|
22
|
+
def initialize(app, env)
|
23
|
+
@app = app
|
24
|
+
end
|
25
|
+
|
26
|
+
def call(env)
|
27
|
+
@app.call(env)
|
28
|
+
end
|
29
|
+
|
30
|
+
def recover(env)
|
31
|
+
env[:recover] << 1
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class ActionTwo
|
36
|
+
def initialize(app, env)
|
37
|
+
@app = app
|
38
|
+
end
|
39
|
+
|
40
|
+
def call(env)
|
41
|
+
@app.call(env)
|
42
|
+
end
|
43
|
+
|
44
|
+
def recover(env)
|
45
|
+
env[:recover] << 2
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
error_proc = Proc.new { raise "ERROR!" }
|
50
|
+
|
51
|
+
data = { :recover => [] }
|
52
|
+
instance = described_class.new([Action, ActionTwo, error_proc], data)
|
53
|
+
|
54
|
+
# The error should be raised back up
|
55
|
+
expect { instance.call(data) }.
|
56
|
+
to raise_error(RuntimeError)
|
57
|
+
|
58
|
+
# Verify the recovery process goes in reverse order
|
59
|
+
data[:recover].should == [2, 1]
|
60
|
+
|
61
|
+
# Verify that the error is available in the data
|
62
|
+
data["vagrant.error"].should be_kind_of(RuntimeError)
|
63
|
+
end
|
64
|
+
|
65
|
+
it "does not do a recovery sequence if SystemExit is raised" do
|
66
|
+
class Action
|
67
|
+
def initialize(app, env)
|
68
|
+
@app = app
|
69
|
+
end
|
70
|
+
|
71
|
+
def call(env)
|
72
|
+
@app.call(env)
|
73
|
+
end
|
74
|
+
|
75
|
+
def recover(env)
|
76
|
+
env[:recover] = true
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# Make a proc that just calls "abort" which raises a
|
81
|
+
# SystemExit exception.
|
82
|
+
error_proc = Proc.new { abort }
|
83
|
+
|
84
|
+
instance = described_class.new([Action, error_proc], data)
|
85
|
+
|
86
|
+
# The SystemExit should come through
|
87
|
+
expect { instance.call(data) }.to raise_error(SystemExit)
|
88
|
+
|
89
|
+
# The recover should not have been called
|
90
|
+
data.has_key?(:recover).should_not be
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,224 @@
|
|
1
|
+
require File.expand_path("../../base", __FILE__)
|
2
|
+
|
3
|
+
require "pathname"
|
4
|
+
require 'tempfile'
|
5
|
+
|
6
|
+
describe Vagrant::BoxCollection do
|
7
|
+
include_context "unit"
|
8
|
+
|
9
|
+
let(:box_class) { Vagrant::Box }
|
10
|
+
let(:environment) { isolated_environment }
|
11
|
+
let(:instance) { described_class.new(environment.boxes_dir) }
|
12
|
+
|
13
|
+
it "should tell us the directory it is using" do
|
14
|
+
instance.directory.should == environment.boxes_dir
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "adding" do
|
18
|
+
it "should add a valid box to the system" do
|
19
|
+
box_path = environment.box2_file(:virtualbox)
|
20
|
+
|
21
|
+
# Add the box
|
22
|
+
box = instance.add(box_path, "foo", :virtualbox)
|
23
|
+
box.should be_kind_of(box_class)
|
24
|
+
box.name.should == "foo"
|
25
|
+
box.provider.should == :virtualbox
|
26
|
+
|
27
|
+
# Verify we can find it as well
|
28
|
+
box = instance.find("foo", :virtualbox)
|
29
|
+
box.should_not be_nil
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should add a box without specifying a provider" do
|
33
|
+
box_path = environment.box2_file(:vmware)
|
34
|
+
|
35
|
+
# Add the box
|
36
|
+
box = instance.add(box_path, "foo")
|
37
|
+
box.should be_kind_of(box_class)
|
38
|
+
box.name.should == "foo"
|
39
|
+
box.provider.should == :vmware
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should add a V1 box" do
|
43
|
+
# Create a V1 box.
|
44
|
+
box_path = environment.box1_file
|
45
|
+
|
46
|
+
# Add the box
|
47
|
+
box = instance.add(box_path, "foo")
|
48
|
+
box.should be_kind_of(box_class)
|
49
|
+
box.name.should == "foo"
|
50
|
+
box.provider.should == :virtualbox
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should raise an exception if the box already exists" do
|
54
|
+
prev_box_name = "foo"
|
55
|
+
prev_box_provider = :virtualbox
|
56
|
+
|
57
|
+
# Create the box we're adding
|
58
|
+
environment.box2(prev_box_name, prev_box_provider)
|
59
|
+
|
60
|
+
# Attempt to add the box with the same name
|
61
|
+
box_path = environment.box2_file(prev_box_provider)
|
62
|
+
expect { instance.add(box_path, prev_box_name, prev_box_provider) }.
|
63
|
+
to raise_error(Vagrant::Errors::BoxAlreadyExists)
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should raise an exception if the box already exists and no provider is given" do
|
67
|
+
# Create some box file
|
68
|
+
box_name = "foo"
|
69
|
+
box_path = environment.box2_file(:vmware)
|
70
|
+
|
71
|
+
# Add it once, successfully
|
72
|
+
expect { instance.add(box_path, box_name) }.to_not raise_error
|
73
|
+
|
74
|
+
# Add it again, and fail!
|
75
|
+
expect { instance.add(box_path, box_name) }.
|
76
|
+
to raise_error(Vagrant::Errors::BoxAlreadyExists)
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should raise an exception if you're attempting to add a box that exists as a V1 box" do
|
80
|
+
prev_box_name = "foo"
|
81
|
+
|
82
|
+
# Create the V1 box
|
83
|
+
environment.box1(prev_box_name)
|
84
|
+
|
85
|
+
# Attempt to add some V2 box with the same name
|
86
|
+
box_path = environment.box2_file(:vmware)
|
87
|
+
expect { instance.add(box_path, prev_box_name) }.
|
88
|
+
to raise_error(Vagrant::Errors::BoxUpgradeRequired)
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should raise an exception and not add the box if the provider doesn't match" do
|
92
|
+
box_name = "foo"
|
93
|
+
good_provider = :virtualbox
|
94
|
+
bad_provider = :vmware
|
95
|
+
|
96
|
+
# Create a VirtualBox box file
|
97
|
+
box_path = environment.box2_file(good_provider)
|
98
|
+
|
99
|
+
# Add the box but with an invalid provider, verify we get the proper
|
100
|
+
# error.
|
101
|
+
expect { instance.add(box_path, box_name, bad_provider) }.
|
102
|
+
to raise_error(Vagrant::Errors::BoxProviderDoesntMatch)
|
103
|
+
|
104
|
+
# Verify the box doesn't exist
|
105
|
+
instance.find(box_name, bad_provider).should be_nil
|
106
|
+
end
|
107
|
+
|
108
|
+
it "should raise an exception if you add an invalid box file" do
|
109
|
+
# Tar Header information
|
110
|
+
CHECKSUM_OFFSET = 148
|
111
|
+
CHECKSUM_LENGTH = 8
|
112
|
+
|
113
|
+
Tempfile.new(['vagrant_testing', '.tar']) do |f|
|
114
|
+
# Corrupt the tar by writing over the checksum field
|
115
|
+
f.seek(CHECKSUM_OFFSET)
|
116
|
+
f.write("\0"*CHECKSUM_LENGTH)
|
117
|
+
f.close
|
118
|
+
|
119
|
+
expect { instance.add(path, "foo", :virtualbox) }.
|
120
|
+
to raise_error(Vagrant::Errors::BoxUnpackageFailure)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
describe "listing all" do
|
126
|
+
it "should return an empty array when no boxes are there" do
|
127
|
+
instance.all.should == []
|
128
|
+
end
|
129
|
+
|
130
|
+
it "should return the boxes and their providers" do
|
131
|
+
# Create some boxes
|
132
|
+
environment.box2("foo", :virtualbox)
|
133
|
+
environment.box2("foo", :vmware)
|
134
|
+
environment.box2("bar", :ec2)
|
135
|
+
|
136
|
+
# Verify some output
|
137
|
+
results = instance.all
|
138
|
+
results.length.should == 3
|
139
|
+
results.include?(["foo", :virtualbox]).should be
|
140
|
+
results.include?(["foo", :vmware]).should be
|
141
|
+
results.include?(["bar", :ec2]).should be
|
142
|
+
end
|
143
|
+
|
144
|
+
it "should return V1 boxes as well" do
|
145
|
+
# Create some boxes, including a V1 box
|
146
|
+
environment.box1("bar")
|
147
|
+
environment.box2("foo", :vmware)
|
148
|
+
|
149
|
+
# Verify some output
|
150
|
+
results = instance.all.sort
|
151
|
+
results.should == [["bar", :virtualbox, :v1], ["foo", :vmware]]
|
152
|
+
end
|
153
|
+
|
154
|
+
it 'does not raise an exception when a file appears in the boxes dir' do
|
155
|
+
Tempfile.new('a_file', environment.boxes_dir)
|
156
|
+
expect { instance.all }.to_not raise_error
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
describe "finding" do
|
161
|
+
it "should return nil if the box does not exist" do
|
162
|
+
instance.find("foo", :i_dont_exist).should be_nil
|
163
|
+
end
|
164
|
+
|
165
|
+
it "should return a box if the box does exist" do
|
166
|
+
# Create the "box"
|
167
|
+
environment.box2("foo", :virtualbox)
|
168
|
+
|
169
|
+
# Actual test
|
170
|
+
result = instance.find("foo", :virtualbox)
|
171
|
+
result.should_not be_nil
|
172
|
+
result.should be_kind_of(box_class)
|
173
|
+
result.name.should == "foo"
|
174
|
+
end
|
175
|
+
|
176
|
+
it "should throw an exception if it is a v1 box" do
|
177
|
+
# Create a V1 box
|
178
|
+
environment.box1("foo")
|
179
|
+
|
180
|
+
# Test!
|
181
|
+
expect { instance.find("foo", :virtualbox) }.
|
182
|
+
to raise_error(Vagrant::Errors::BoxUpgradeRequired)
|
183
|
+
end
|
184
|
+
|
185
|
+
it "should return nil if there is a V1 box but we're looking for another provider" do
|
186
|
+
# Create a V1 box
|
187
|
+
environment.box1("foo")
|
188
|
+
|
189
|
+
# Test
|
190
|
+
instance.find("foo", :another_provider).should be_nil
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
describe "upgrading" do
|
195
|
+
it "should upgrade a V1 box to V2" do
|
196
|
+
# Create a V1 box
|
197
|
+
environment.box1("foo")
|
198
|
+
|
199
|
+
# Verify that only a V1 box exists
|
200
|
+
expect { instance.find("foo", :virtualbox) }.
|
201
|
+
to raise_error(Vagrant::Errors::BoxUpgradeRequired)
|
202
|
+
|
203
|
+
# Upgrade the box
|
204
|
+
instance.upgrade("foo").should be
|
205
|
+
|
206
|
+
# Verify the box exists
|
207
|
+
box = instance.find("foo", :virtualbox)
|
208
|
+
box.should_not be_nil
|
209
|
+
box.name.should == "foo"
|
210
|
+
end
|
211
|
+
|
212
|
+
it "should raise a BoxNotFound exception if a non-existent box is upgraded" do
|
213
|
+
expect { instance.upgrade("i-dont-exist") }.
|
214
|
+
to raise_error(Vagrant::Errors::BoxNotFound)
|
215
|
+
end
|
216
|
+
|
217
|
+
it "should return true if we try to upgrade a V2 box" do
|
218
|
+
# Create a V2 box
|
219
|
+
environment.box2("foo", :vmware)
|
220
|
+
|
221
|
+
instance.upgrade("foo").should be
|
222
|
+
end
|
223
|
+
end
|
224
|
+
end
|