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,471 @@
|
|
1
|
+
require 'log4r'
|
2
|
+
|
3
|
+
require File.expand_path("../base", __FILE__)
|
4
|
+
|
5
|
+
module VagrantPlugins
|
6
|
+
module ProviderVirtualBox
|
7
|
+
module Driver
|
8
|
+
# Driver for VirtualBox 4.2.x
|
9
|
+
class Version_4_2 < Base
|
10
|
+
def initialize(uuid)
|
11
|
+
super()
|
12
|
+
|
13
|
+
@logger = Log4r::Logger.new("vagrant::provider::virtualbox_4_2")
|
14
|
+
@uuid = uuid
|
15
|
+
end
|
16
|
+
|
17
|
+
def clear_forwarded_ports
|
18
|
+
args = []
|
19
|
+
read_forwarded_ports(@uuid).each do |nic, name, _, _|
|
20
|
+
args.concat(["--natpf#{nic}", "delete", name])
|
21
|
+
end
|
22
|
+
|
23
|
+
execute("modifyvm", @uuid, *args) if !args.empty?
|
24
|
+
end
|
25
|
+
|
26
|
+
def clear_shared_folders
|
27
|
+
info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true)
|
28
|
+
info.split("\n").each do |line|
|
29
|
+
if line =~ /^SharedFolderNameMachineMapping\d+="(.+?)"$/
|
30
|
+
execute("sharedfolder", "remove", @uuid, "--name", $1.to_s)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def create_dhcp_server(network, options)
|
36
|
+
execute("dhcpserver", "add", "--ifname", network,
|
37
|
+
"--ip", options[:dhcp_ip],
|
38
|
+
"--netmask", options[:netmask],
|
39
|
+
"--lowerip", options[:dhcp_lower],
|
40
|
+
"--upperip", options[:dhcp_upper],
|
41
|
+
"--enable")
|
42
|
+
end
|
43
|
+
|
44
|
+
def create_host_only_network(options)
|
45
|
+
# Create the interface
|
46
|
+
execute("hostonlyif", "create") =~ /^Interface '(.+?)' was successfully created$/
|
47
|
+
name = $1.to_s
|
48
|
+
|
49
|
+
# Configure it
|
50
|
+
execute("hostonlyif", "ipconfig", name,
|
51
|
+
"--ip", options[:adapter_ip],
|
52
|
+
"--netmask", options[:netmask])
|
53
|
+
|
54
|
+
# Return the details
|
55
|
+
return {
|
56
|
+
:name => name,
|
57
|
+
:ip => options[:adapter_ip],
|
58
|
+
:netmask => options[:netmask],
|
59
|
+
:dhcp => nil
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
def delete
|
64
|
+
execute("unregistervm", @uuid, "--delete")
|
65
|
+
end
|
66
|
+
|
67
|
+
def delete_unused_host_only_networks
|
68
|
+
networks = []
|
69
|
+
execute("list", "hostonlyifs").split("\n").each do |line|
|
70
|
+
networks << $1.to_s if line =~ /^Name:\s+(.+?)$/
|
71
|
+
end
|
72
|
+
|
73
|
+
execute("list", "vms").split("\n").each do |line|
|
74
|
+
if line =~ /^".+?"\s+\{(.+?)\}$/
|
75
|
+
info = execute("showvminfo", $1.to_s, "--machinereadable", :retryable => true)
|
76
|
+
info.split("\n").each do |inner_line|
|
77
|
+
if inner_line =~ /^hostonlyadapter\d+="(.+?)"$/
|
78
|
+
networks.delete($1.to_s)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
networks.each do |name|
|
85
|
+
# First try to remove any DHCP servers attached. We use `raw` because
|
86
|
+
# it is okay if this fails. It usually means that a DHCP server was
|
87
|
+
# never attached.
|
88
|
+
raw("dhcpserver", "remove", "--ifname", name)
|
89
|
+
|
90
|
+
# Delete the actual host only network interface.
|
91
|
+
execute("hostonlyif", "remove", name)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def discard_saved_state
|
96
|
+
execute("discardstate", @uuid)
|
97
|
+
end
|
98
|
+
|
99
|
+
def enable_adapters(adapters)
|
100
|
+
args = []
|
101
|
+
adapters.each do |adapter|
|
102
|
+
args.concat(["--nic#{adapter[:adapter]}", adapter[:type].to_s])
|
103
|
+
|
104
|
+
if adapter[:bridge]
|
105
|
+
args.concat(["--bridgeadapter#{adapter[:adapter]}",
|
106
|
+
adapter[:bridge]])
|
107
|
+
end
|
108
|
+
|
109
|
+
if adapter[:hostonly]
|
110
|
+
args.concat(["--hostonlyadapter#{adapter[:adapter]}",
|
111
|
+
adapter[:hostonly]])
|
112
|
+
end
|
113
|
+
|
114
|
+
if adapter[:mac_address]
|
115
|
+
args.concat(["--macaddress#{adapter[:adapter]}",
|
116
|
+
adapter[:mac_address]])
|
117
|
+
end
|
118
|
+
|
119
|
+
if adapter[:nic_type]
|
120
|
+
args.concat(["--nictype#{adapter[:adapter]}", adapter[:nic_type].to_s])
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
execute("modifyvm", @uuid, *args)
|
125
|
+
end
|
126
|
+
|
127
|
+
def execute_command(command)
|
128
|
+
raw(*command)
|
129
|
+
end
|
130
|
+
|
131
|
+
def export(path)
|
132
|
+
# TODO: Progress
|
133
|
+
execute("export", @uuid, "--output", path.to_s)
|
134
|
+
end
|
135
|
+
|
136
|
+
def forward_ports(ports)
|
137
|
+
args = []
|
138
|
+
ports.each do |options|
|
139
|
+
pf_builder = [options[:name],
|
140
|
+
options[:protocol] || "tcp",
|
141
|
+
"",
|
142
|
+
options[:hostport],
|
143
|
+
"",
|
144
|
+
options[:guestport]]
|
145
|
+
|
146
|
+
args.concat(["--natpf#{options[:adapter] || 1}",
|
147
|
+
pf_builder.join(",")])
|
148
|
+
end
|
149
|
+
|
150
|
+
execute("modifyvm", @uuid, *args) if !args.empty?
|
151
|
+
end
|
152
|
+
|
153
|
+
def halt
|
154
|
+
execute("controlvm", @uuid, "poweroff")
|
155
|
+
end
|
156
|
+
|
157
|
+
def import(ovf)
|
158
|
+
output = ""
|
159
|
+
total = ""
|
160
|
+
last = 0
|
161
|
+
execute("import", ovf) do |type, data|
|
162
|
+
if type == :stdout
|
163
|
+
# Keep track of the stdout so that we can get the VM name
|
164
|
+
output << data
|
165
|
+
elsif type == :stderr
|
166
|
+
# Append the data so we can see the full view
|
167
|
+
total << data
|
168
|
+
|
169
|
+
# Break up the lines. We can't get the progress until we see an "OK"
|
170
|
+
lines = total.split("\n")
|
171
|
+
if lines.include?("OK.")
|
172
|
+
# The progress of the import will be in the last line. Do a greedy
|
173
|
+
# regular expression to find what we're looking for.
|
174
|
+
if lines.last =~ /.+(\d{2})%/
|
175
|
+
current = $1.to_i
|
176
|
+
if current > last
|
177
|
+
last = current
|
178
|
+
yield current if block_given?
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
# Find the name of the VM name
|
186
|
+
if output !~ /Suggested VM name "(.+?)"/
|
187
|
+
@logger.error("Couldn't find VM name in the output.")
|
188
|
+
return nil
|
189
|
+
end
|
190
|
+
|
191
|
+
name = $1.to_s
|
192
|
+
|
193
|
+
output = execute("list", "vms")
|
194
|
+
if output =~ /^"#{Regexp.escape(name)}" \{(.+?)\}$/
|
195
|
+
return $1.to_s
|
196
|
+
end
|
197
|
+
|
198
|
+
nil
|
199
|
+
end
|
200
|
+
|
201
|
+
def read_forwarded_ports(uuid=nil, active_only=false)
|
202
|
+
uuid ||= @uuid
|
203
|
+
|
204
|
+
@logger.debug("read_forward_ports: uuid=#{uuid} active_only=#{active_only}")
|
205
|
+
|
206
|
+
results = []
|
207
|
+
current_nic = nil
|
208
|
+
info = execute("showvminfo", uuid, "--machinereadable", :retryable => true)
|
209
|
+
info.split("\n").each do |line|
|
210
|
+
# This is how we find the nic that a FP is attached to,
|
211
|
+
# since this comes first.
|
212
|
+
current_nic = $1.to_i if line =~ /^nic(\d+)=".+?"$/
|
213
|
+
|
214
|
+
# If we care about active VMs only, then we check the state
|
215
|
+
# to verify the VM is running.
|
216
|
+
if active_only && line =~ /^VMState="(.+?)"$/ && $1.to_s != "running"
|
217
|
+
return []
|
218
|
+
end
|
219
|
+
|
220
|
+
# Parse out the forwarded port information
|
221
|
+
if line =~ /^Forwarding.+?="(.+?),.+?,.*?,(.+?),.*?,(.+?)"$/
|
222
|
+
result = [current_nic, $1.to_s, $2.to_i, $3.to_i]
|
223
|
+
@logger.debug(" - #{result.inspect}")
|
224
|
+
results << result
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
results
|
229
|
+
end
|
230
|
+
|
231
|
+
def read_bridged_interfaces
|
232
|
+
execute("list", "bridgedifs").split("\n\n").collect do |block|
|
233
|
+
info = {}
|
234
|
+
|
235
|
+
block.split("\n").each do |line|
|
236
|
+
if line =~ /^Name:\s+(.+?)$/
|
237
|
+
info[:name] = $1.to_s
|
238
|
+
elsif line =~ /^IPAddress:\s+(.+?)$/
|
239
|
+
info[:ip] = $1.to_s
|
240
|
+
elsif line =~ /^NetworkMask:\s+(.+?)$/
|
241
|
+
info[:netmask] = $1.to_s
|
242
|
+
elsif line =~ /^Status:\s+(.+?)$/
|
243
|
+
info[:status] = $1.to_s
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
# Return the info to build up the results
|
248
|
+
info
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
def read_guest_additions_version
|
253
|
+
output = execute("guestproperty", "get", @uuid, "/VirtualBox/GuestAdd/Version",
|
254
|
+
:retryable => true)
|
255
|
+
if output =~ /^Value: (.+?)$/
|
256
|
+
# Split the version by _ since some distro versions modify it
|
257
|
+
# to look like this: 4.1.2_ubuntu, and the distro part isn't
|
258
|
+
# too important.
|
259
|
+
value = $1.to_s
|
260
|
+
return value.split("_").first
|
261
|
+
end
|
262
|
+
|
263
|
+
return nil
|
264
|
+
end
|
265
|
+
|
266
|
+
def read_host_only_interfaces
|
267
|
+
dhcp = {}
|
268
|
+
execute("list", "dhcpservers", :retryable => true).split("\n\n").each do |block|
|
269
|
+
info = {}
|
270
|
+
|
271
|
+
block.split("\n").each do |line|
|
272
|
+
if line =~ /^NetworkName:\s+HostInterfaceNetworking-(.+?)$/
|
273
|
+
info[:network] = $1.to_s
|
274
|
+
elsif line =~ /^IP:\s+(.+?)$/
|
275
|
+
info[:ip] = $1.to_s
|
276
|
+
elsif line =~ /^lowerIPAddress:\s+(.+?)$/
|
277
|
+
info[:lower] = $1.to_s
|
278
|
+
elsif line =~ /^upperIPAddress:\s+(.+?)$/
|
279
|
+
info[:upper] = $1.to_s
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
# Set the DHCP info
|
284
|
+
dhcp[info[:network]] = info
|
285
|
+
end
|
286
|
+
|
287
|
+
execute("list", "hostonlyifs", :retryable => true).split("\n\n").collect do |block|
|
288
|
+
info = {}
|
289
|
+
|
290
|
+
block.split("\n").each do |line|
|
291
|
+
if line =~ /^Name:\s+(.+?)$/
|
292
|
+
info[:name] = $1.to_s
|
293
|
+
elsif line =~ /^IPAddress:\s+(.+?)$/
|
294
|
+
info[:ip] = $1.to_s
|
295
|
+
elsif line =~ /^NetworkMask:\s+(.+?)$/
|
296
|
+
info[:netmask] = $1.to_s
|
297
|
+
elsif line =~ /^Status:\s+(.+?)$/
|
298
|
+
info[:status] = $1.to_s
|
299
|
+
end
|
300
|
+
end
|
301
|
+
|
302
|
+
# Set the DHCP info if it exists
|
303
|
+
info[:dhcp] = dhcp[info[:name]] if dhcp[info[:name]]
|
304
|
+
|
305
|
+
info
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
def read_mac_address
|
310
|
+
info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true)
|
311
|
+
info.split("\n").each do |line|
|
312
|
+
return $1.to_s if line =~ /^macaddress1="(.+?)"$/
|
313
|
+
end
|
314
|
+
|
315
|
+
nil
|
316
|
+
end
|
317
|
+
|
318
|
+
def read_machine_folder
|
319
|
+
execute("list", "systemproperties", :retryable => true).split("\n").each do |line|
|
320
|
+
if line =~ /^Default machine folder:\s+(.+?)$/i
|
321
|
+
return $1.to_s
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
nil
|
326
|
+
end
|
327
|
+
|
328
|
+
def read_network_interfaces
|
329
|
+
nics = {}
|
330
|
+
info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true)
|
331
|
+
info.split("\n").each do |line|
|
332
|
+
if line =~ /^nic(\d+)="(.+?)"$/
|
333
|
+
adapter = $1.to_i
|
334
|
+
type = $2.to_sym
|
335
|
+
|
336
|
+
nics[adapter] ||= {}
|
337
|
+
nics[adapter][:type] = type
|
338
|
+
elsif line =~ /^hostonlyadapter(\d+)="(.+?)"$/
|
339
|
+
adapter = $1.to_i
|
340
|
+
network = $2.to_s
|
341
|
+
|
342
|
+
nics[adapter] ||= {}
|
343
|
+
nics[adapter][:hostonly] = network
|
344
|
+
elsif line =~ /^bridgeadapter(\d+)="(.+?)"$/
|
345
|
+
adapter = $1.to_i
|
346
|
+
network = $2.to_s
|
347
|
+
|
348
|
+
nics[adapter] ||= {}
|
349
|
+
nics[adapter][:bridge] = network
|
350
|
+
end
|
351
|
+
end
|
352
|
+
|
353
|
+
nics
|
354
|
+
end
|
355
|
+
|
356
|
+
def read_state
|
357
|
+
output = execute("showvminfo", @uuid, "--machinereadable", :retryable => true)
|
358
|
+
if output =~ /^name="<inaccessible>"$/
|
359
|
+
return :inaccessible
|
360
|
+
elsif output =~ /^VMState="(.+?)"$/
|
361
|
+
return $1.to_sym
|
362
|
+
end
|
363
|
+
|
364
|
+
nil
|
365
|
+
end
|
366
|
+
|
367
|
+
def read_used_ports
|
368
|
+
ports = []
|
369
|
+
execute("list", "vms", :retryable => true).split("\n").each do |line|
|
370
|
+
if line =~ /^".+?" \{(.+?)\}$/
|
371
|
+
uuid = $1.to_s
|
372
|
+
|
373
|
+
# Ignore our own used ports
|
374
|
+
next if uuid == @uuid
|
375
|
+
|
376
|
+
read_forwarded_ports(uuid, true).each do |_, _, hostport, _|
|
377
|
+
ports << hostport
|
378
|
+
end
|
379
|
+
end
|
380
|
+
end
|
381
|
+
|
382
|
+
ports
|
383
|
+
end
|
384
|
+
|
385
|
+
def read_vms
|
386
|
+
results = {}
|
387
|
+
execute("list", "vms", :retryable => true).split("\n").each do |line|
|
388
|
+
if line =~ /^"(.+?)" \{(.+?)\}$/
|
389
|
+
results[$1.to_s] = $2.to_s
|
390
|
+
end
|
391
|
+
end
|
392
|
+
|
393
|
+
results
|
394
|
+
end
|
395
|
+
|
396
|
+
def set_mac_address(mac)
|
397
|
+
execute("modifyvm", @uuid, "--macaddress1", mac)
|
398
|
+
end
|
399
|
+
|
400
|
+
def set_name(name)
|
401
|
+
execute("modifyvm", @uuid, "--name", name, :retryable => true)
|
402
|
+
end
|
403
|
+
|
404
|
+
def share_folders(folders)
|
405
|
+
folders.each do |folder|
|
406
|
+
args = ["--name",
|
407
|
+
folder[:name],
|
408
|
+
"--hostpath",
|
409
|
+
folder[:hostpath]]
|
410
|
+
args << "--transient" if folder.has_key?(:transient) && folder[:transient]
|
411
|
+
|
412
|
+
# Add the shared folder
|
413
|
+
execute("sharedfolder", "add", @uuid, *args)
|
414
|
+
|
415
|
+
# Enable symlinks on the shared folder
|
416
|
+
execute("setextradata", @uuid, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/#{folder[:name]}", "1")
|
417
|
+
end
|
418
|
+
end
|
419
|
+
|
420
|
+
def ssh_port(expected_port)
|
421
|
+
@logger.debug("Searching for SSH port: #{expected_port.inspect}")
|
422
|
+
|
423
|
+
# Look for the forwarded port only by comparing the guest port
|
424
|
+
read_forwarded_ports.each do |_, _, hostport, guestport|
|
425
|
+
return hostport if guestport == expected_port
|
426
|
+
end
|
427
|
+
|
428
|
+
nil
|
429
|
+
end
|
430
|
+
|
431
|
+
def resume
|
432
|
+
@logger.debug("Resuming paused VM...")
|
433
|
+
execute("controlvm", @uuid, "resume")
|
434
|
+
end
|
435
|
+
|
436
|
+
def start(mode)
|
437
|
+
command = ["startvm", @uuid, "--type", mode.to_s]
|
438
|
+
r = raw(*command)
|
439
|
+
|
440
|
+
if r.exit_code == 0 || r.stdout =~ /VM ".+?" has been successfully started/
|
441
|
+
# Some systems return an exit code 1 for some reason. For that
|
442
|
+
# we depend on the output.
|
443
|
+
return true
|
444
|
+
end
|
445
|
+
|
446
|
+
# If we reached this point then it didn't work out.
|
447
|
+
raise Vagrant::Errors::VBoxManageError, :command => command.inspect
|
448
|
+
end
|
449
|
+
|
450
|
+
def suspend
|
451
|
+
execute("controlvm", @uuid, "savestate")
|
452
|
+
end
|
453
|
+
|
454
|
+
def verify!
|
455
|
+
# This command sometimes fails if kernel drivers aren't properly loaded
|
456
|
+
# so we just run the command and verify that it succeeded.
|
457
|
+
execute("list", "hostonlyifs")
|
458
|
+
end
|
459
|
+
|
460
|
+
def verify_image(path)
|
461
|
+
r = raw("import", path.to_s, "--dry-run")
|
462
|
+
return r.exit_code == 0
|
463
|
+
end
|
464
|
+
|
465
|
+
def vm_exists?(uuid)
|
466
|
+
raw("showvminfo", uuid).exit_code == 0
|
467
|
+
end
|
468
|
+
end
|
469
|
+
end
|
470
|
+
end
|
471
|
+
end
|