vagrant-unbundled 1.8.4.2 → 1.8.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +52 -0
- data/Gemfile.lock +9 -7
- data/RELEASE.md +37 -14
- data/lib/vagrant/action/builtin/box_add.rb +3 -1
- data/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb +5 -0
- data/lib/vagrant/box_collection.rb +2 -1
- data/lib/vagrant/bundler.rb +36 -1
- data/lib/vagrant/errors.rb +16 -8
- data/lib/vagrant/plugin/state_file.rb +8 -1
- data/lib/vagrant/util/platform.rb +1 -1
- data/plugins/guests/arch/cap/change_host_name.rb +13 -10
- data/plugins/guests/arch/cap/configure_networks.rb +11 -8
- data/plugins/guests/arch/cap/nfs.rb +35 -0
- data/plugins/guests/arch/cap/rsync.rb +16 -0
- data/plugins/guests/arch/cap/smb.rb +17 -0
- data/plugins/guests/arch/plugin.rb +28 -3
- data/plugins/guests/atomic/cap/change_host_name.rb +13 -10
- data/plugins/guests/atomic/plugin.rb +3 -3
- data/plugins/guests/{netbsd → bsd}/cap/halt.rb +2 -2
- data/plugins/guests/bsd/cap/nfs.rb +49 -0
- data/plugins/guests/bsd/cap/public_key.rb +65 -0
- data/plugins/guests/bsd/cap/virtualbox.rb +16 -0
- data/plugins/guests/bsd/guest.rb +9 -0
- data/plugins/guests/bsd/plugin.rb +40 -0
- data/plugins/guests/coreos/cap/change_host_name.rb +1 -1
- data/plugins/guests/coreos/plugin.rb +4 -4
- data/plugins/guests/darwin/cap/change_host_name.rb +4 -1
- data/plugins/guests/darwin/cap/configure_networks.rb +12 -5
- data/plugins/guests/darwin/cap/halt.rb +3 -1
- data/plugins/guests/darwin/cap/rsync.rb +7 -4
- data/plugins/guests/darwin/plugin.rb +13 -28
- data/plugins/guests/debian/cap/change_host_name.rb +14 -15
- data/plugins/guests/debian/cap/configure_networks.rb +2 -6
- data/plugins/guests/debian/cap/{nfs_client.rb → nfs.rb} +2 -1
- data/plugins/guests/debian/cap/rsync.rb +5 -6
- data/plugins/guests/debian/plugin.rb +8 -8
- data/plugins/guests/esxi/cap/mount_nfs_folder.rb +2 -2
- data/plugins/guests/esxi/plugin.rb +6 -6
- data/plugins/guests/fedora/cap/flavor.rb +1 -1
- data/plugins/guests/fedora/plugin.rb +2 -17
- data/plugins/guests/freebsd/cap/change_host_name.rb +2 -3
- data/plugins/guests/freebsd/cap/rsync.rb +7 -4
- data/plugins/guests/freebsd/plugin.rb +9 -29
- data/plugins/guests/funtoo/plugin.rb +3 -8
- data/plugins/guests/gentoo/cap/change_host_name.rb +21 -6
- data/plugins/guests/gentoo/cap/configure_networks.rb +35 -26
- data/plugins/guests/gentoo/plugin.rb +4 -4
- data/plugins/guests/linux/cap/choose_addressable_ip_addr.rb +2 -3
- data/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb +31 -45
- data/plugins/guests/linux/cap/network_interfaces.rb +20 -0
- data/plugins/guests/linux/cap/nfs.rb +57 -0
- data/plugins/guests/linux/cap/public_key.rb +65 -0
- data/plugins/guests/linux/cap/rsync.rb +7 -4
- data/plugins/guests/linux/plugin.rb +30 -25
- data/plugins/guests/mint/plugin.rb +1 -1
- data/plugins/guests/netbsd/plugin.rb +10 -30
- data/plugins/guests/nixos/plugin.rb +5 -5
- data/plugins/guests/omnios/cap/change_host_name.rb +1 -1
- data/plugins/guests/omnios/plugin.rb +4 -4
- data/plugins/guests/openbsd/cap/change_host_name.rb +21 -3
- data/plugins/guests/openbsd/plugin.rb +10 -30
- data/plugins/guests/photon/cap/change_host_name.rb +1 -1
- data/plugins/guests/photon/plugin.rb +4 -4
- data/plugins/guests/pld/cap/change_host_name.rb +1 -1
- data/plugins/guests/pld/plugin.rb +4 -4
- data/plugins/guests/redhat/cap/change_host_name.rb +4 -3
- data/plugins/guests/redhat/cap/configure_networks.rb +1 -24
- data/plugins/guests/redhat/plugin.rb +7 -7
- data/plugins/guests/slackware/cap/change_host_name.rb +1 -1
- data/plugins/guests/slackware/cap/configure_networks.rb +1 -5
- data/plugins/guests/slackware/plugin.rb +3 -3
- data/plugins/guests/smartos/plugin.rb +12 -12
- data/plugins/guests/solaris/plugin.rb +14 -14
- data/plugins/guests/solaris11/plugin.rb +12 -12
- data/plugins/guests/suse/cap/change_host_name.rb +1 -1
- data/plugins/guests/suse/cap/configure_networks.rb +1 -5
- data/plugins/guests/suse/plugin.rb +8 -8
- data/plugins/guests/tinycore/cap/mount_nfs.rb +2 -2
- data/plugins/guests/tinycore/plugin.rb +7 -7
- data/plugins/guests/trisquel/plugin.rb +1 -1
- data/plugins/guests/ubuntu/guest.rb +1 -1
- data/plugins/guests/ubuntu/plugin.rb +1 -6
- data/plugins/guests/windows/plugin.rb +2 -2
- data/plugins/kernel_v2/config/vm.rb +8 -1
- data/plugins/providers/hyperv/scripts/get_vm_status.ps1 +25 -5
- data/plugins/providers/virtualbox/driver/meta.rb +1 -0
- data/plugins/providers/virtualbox/driver/version_5_1.rb +734 -0
- data/plugins/providers/virtualbox/plugin.rb +1 -0
- data/plugins/synced_folders/nfs/synced_folder.rb +10 -2
- data/plugins/synced_folders/rsync/helper.rb +11 -4
- data/scripts/{bintray_upload.sh → sign.sh} +0 -0
- data/templates/guests/arch/network_static.erb +3 -3
- data/templates/guests/arch/network_static6.erb +8 -0
- data/templates/guests/freebsd/network_static6.erb +6 -0
- data/templates/guests/funtoo/network_static6.erb +9 -0
- data/templates/guests/gentoo/network_dhcp.erb +1 -1
- data/templates/guests/gentoo/network_static.erb +4 -4
- data/templates/guests/gentoo/network_static6.erb +7 -0
- data/templates/guests/redhat/network_dhcp.erb +1 -1
- data/templates/guests/redhat/network_static.erb +4 -1
- data/templates/guests/{fedora → redhat}/network_static6.erb +5 -2
- data/templates/locales/en.yml +40 -6
- data/test/unit/plugins/guests/arch/cap/change_host_name_test.rb +6 -6
- data/test/unit/plugins/guests/arch/cap/configure_networks_test.rb +20 -15
- data/test/unit/plugins/guests/arch/cap/rsync_test.rb +30 -0
- data/test/unit/plugins/guests/arch/cap/smb_test.rb +38 -0
- data/test/unit/plugins/guests/atomic/cap/change_host_name_test.rb +9 -8
- data/test/unit/plugins/guests/{freebsd → bsd}/cap/halt_test.rb +11 -10
- data/test/unit/plugins/guests/{freebsd → bsd}/cap/insert_public_key_test.rb +7 -6
- data/test/unit/plugins/guests/bsd/cap/nfs_test.rb +68 -0
- data/test/unit/plugins/guests/coreos/cap/change_host_name_test.rb +5 -5
- data/test/unit/plugins/guests/darwin/cap/change_host_name_test.rb +5 -5
- data/test/unit/plugins/guests/darwin/cap/halt_test.rb +36 -0
- data/test/unit/plugins/guests/debian/cap/change_host_name_test.rb +3 -5
- data/test/unit/plugins/guests/debian/cap/configure_networks_test.rb +13 -9
- data/test/unit/plugins/guests/debian/cap/rsync_test.rb +3 -11
- data/test/unit/plugins/guests/freebsd/cap/change_host_name_test.rb +2 -2
- data/test/unit/plugins/guests/linux/cap/mount_nfs_test.rb +16 -3
- data/test/unit/plugins/guests/omnios/cap/change_host_name_test.rb +2 -2
- data/test/unit/plugins/guests/photon/cap/change_host_name_test.rb +2 -2
- data/test/unit/plugins/guests/pld/cap/change_host_name_test.rb +2 -2
- data/test/unit/plugins/guests/redhat/cap/change_host_name_test.rb +4 -3
- data/test/unit/plugins/guests/redhat/cap/configure_networks_test.rb +17 -33
- data/test/unit/plugins/guests/slackware/cap/change_host_name_test.rb +2 -2
- data/test/unit/plugins/guests/slackware/cap/configure_networks_test.rb +8 -4
- data/test/unit/plugins/guests/suse/cap/change_host_name_test.rb +2 -2
- data/test/unit/plugins/guests/suse/cap/configure_networks_test.rb +13 -16
- data/test/unit/plugins/kernel_v2/config/vm_test.rb +10 -2
- data/test/unit/templates/guests/arch/network_static_test.rb +4 -2
- data/test/unit/templates/guests/gentoo/network_dhcp_test.rb +2 -2
- data/test/unit/templates/guests/gentoo/network_static_test.rb +10 -10
- data/test/unit/templates/guests/redhat/network_dhcp_test.rb +2 -2
- data/test/unit/templates/guests/redhat/network_static_test.rb +9 -9
- data/vagrant.gemspec +3 -3
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/CHANGELOG.md +1 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/CONTRIBUTING.md +38 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/LICENSE.txt +22 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/README.md +297 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/bin/listen +12 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/adapter/base.rb +141 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/adapter/bsd.rb +106 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/adapter/config.rb +26 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/adapter/darwin.rb +92 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/adapter/linux.rb +106 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/adapter/polling.rb +37 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/adapter/windows.rb +98 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/adapter.rb +45 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/backend.rb +38 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/change.rb +76 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/cli.rb +65 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/directory.rb +87 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/event/config.rb +55 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/event/loop.rb +117 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/event/processor.rb +122 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/event/queue.rb +55 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/file.rb +80 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/fsm.rb +132 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/internals/thread_pool.rb +29 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/listener/config.rb +41 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/listener.rb +133 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/logger.rb +32 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/options.rb +23 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/queue_optimizer.rb +132 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/record/entry.rb +64 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/record/symlink_detector.rb +39 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/record.rb +118 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/silencer/controller.rb +48 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/silencer.rb +97 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen/version.rb +3 -0
- data/vendor/bundle/ruby/2.3.0/gems/listen-3.1.5/lib/listen.rb +57 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/.gitignore +8 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/.rspec +2 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/.rubocop-disables.yml +384 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/.rubocop.yml +3 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/.travis.yml +43 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/AUTHORS +98 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/Gemfile +11 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/LICENSE +21 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/README.md +667 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/Rakefile +132 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/bin/restclient +92 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/history.md +310 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/lib/rest-client.rb +2 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/lib/rest_client.rb +2 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/lib/restclient/abstract_response.rb +226 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/lib/restclient/exceptions.rb +244 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/lib/restclient/params_array.rb +72 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/lib/restclient/payload.rb +209 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/lib/restclient/platform.rb +49 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/lib/restclient/raw_response.rb +38 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/lib/restclient/request.rb +904 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/lib/restclient/resource.rb +168 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/lib/restclient/response.rb +80 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/lib/restclient/utils.rb +235 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/lib/restclient/version.rb +8 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/lib/restclient/windows/root_certs.rb +105 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/lib/restclient/windows.rb +8 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/lib/restclient.rb +184 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/rest-client.gemspec +31 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/rest-client.windows.gemspec +19 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/helpers.rb +22 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/integration/_lib.rb +1 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/integration/capath_digicert/244b5494.0 +19 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/integration/capath_digicert/81b9768f.0 +19 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/integration/capath_digicert/README +8 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/integration/capath_digicert/digicert.crt +19 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/integration/capath_verisign/415660c1.0 +14 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/integration/capath_verisign/7651b327.0 +14 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/integration/capath_verisign/README +8 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/integration/capath_verisign/verisign.crt +14 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/integration/certs/digicert.crt +19 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/integration/certs/verisign.crt +14 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/integration/httpbin_spec.rb +86 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/integration/integration_spec.rb +125 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/integration/request_spec.rb +127 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/spec_helper.rb +29 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/unit/_lib.rb +1 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/unit/abstract_response_spec.rb +145 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/unit/exceptions_spec.rb +108 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/unit/master_shake.jpg +0 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/unit/params_array_spec.rb +36 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/unit/payload_spec.rb +263 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/unit/raw_response_spec.rb +18 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/unit/request2_spec.rb +54 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/unit/request_spec.rb +1265 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/unit/resource_spec.rb +130 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/unit/response_spec.rb +241 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/unit/restclient_spec.rb +79 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/unit/utils_spec.rb +147 -0
- data/vendor/bundle/ruby/2.3.0/gems/rest-client-2.0.0/spec/unit/windows/root_certs_spec.rb +22 -0
- data/vendor/bundle/ruby/2.3.0/gems/ruby_dep-1.4.0/.gitignore +10 -0
- data/vendor/bundle/ruby/2.3.0/gems/ruby_dep-1.4.0/.rspec +3 -0
- data/vendor/bundle/ruby/2.3.0/gems/ruby_dep-1.4.0/.rubocop.yml +3 -0
- data/vendor/bundle/ruby/2.3.0/gems/ruby_dep-1.4.0/.travis.yml +11 -0
- data/vendor/bundle/ruby/2.3.0/gems/ruby_dep-1.4.0/LICENSE.txt +21 -0
- data/vendor/bundle/ruby/2.3.0/gems/ruby_dep-1.4.0/README.md +151 -0
- data/vendor/bundle/ruby/2.3.0/gems/ruby_dep-1.4.0/lib/ruby_dep/logger.rb +16 -0
- data/vendor/bundle/ruby/2.3.0/gems/ruby_dep-1.4.0/lib/ruby_dep/quiet.rb +3 -0
- data/vendor/bundle/ruby/2.3.0/gems/ruby_dep-1.4.0/lib/ruby_dep/ruby_version.rb +58 -0
- data/vendor/bundle/ruby/2.3.0/gems/ruby_dep-1.4.0/lib/ruby_dep/travis/ruby_version.rb +59 -0
- data/vendor/bundle/ruby/2.3.0/gems/ruby_dep-1.4.0/lib/ruby_dep/travis.rb +58 -0
- data/vendor/bundle/ruby/2.3.0/gems/ruby_dep-1.4.0/lib/ruby_dep/version.rb +3 -0
- data/vendor/bundle/ruby/2.3.0/gems/ruby_dep-1.4.0/lib/ruby_dep/warning.rb +97 -0
- data/vendor/bundle/ruby/2.3.0/gems/ruby_dep-1.4.0/lib/ruby_dep.rb +2 -0
- data/vendor/bundle/ruby/2.3.0/specifications/listen-3.1.5.gemspec +44 -0
- data/vendor/bundle/ruby/2.3.0/specifications/rest-client-2.0.0.gemspec +60 -0
- data/vendor/bundle/ruby/2.3.0/specifications/ruby_dep-1.4.0.gemspec +34 -0
- data/version.txt +1 -1
- metadata +147 -44
- data/plugins/guests/darwin/cap/insert_public_key.rb +0 -33
- data/plugins/guests/darwin/cap/mount_nfs_folder.rb +0 -37
- data/plugins/guests/darwin/cap/remove_public_key.rb +0 -21
- data/plugins/guests/fedora/cap/change_host_name.rb +0 -29
- data/plugins/guests/fedora/cap/configure_networks.rb +0 -135
- data/plugins/guests/fedora/cap/network_scripts_dir.rb +0 -15
- data/plugins/guests/freebsd/cap/halt.rb +0 -16
- data/plugins/guests/freebsd/cap/insert_public_key.rb +0 -34
- data/plugins/guests/freebsd/cap/mount_nfs_folder.rb +0 -24
- data/plugins/guests/freebsd/cap/remove_public_key.rb +0 -21
- data/plugins/guests/funtoo/cap/change_host_name.rb +0 -17
- data/plugins/guests/linux/cap/insert_public_key.rb +0 -31
- data/plugins/guests/linux/cap/mount_nfs.rb +0 -50
- data/plugins/guests/linux/cap/nfs_client.rb +0 -11
- data/plugins/guests/linux/cap/remove_public_key.rb +0 -24
- data/plugins/guests/netbsd/cap/insert_public_key.rb +0 -21
- data/plugins/guests/netbsd/cap/mount_nfs_folder.rb +0 -17
- data/plugins/guests/netbsd/cap/remove_public_key.rb +0 -21
- data/plugins/guests/openbsd/cap/halt.rb +0 -16
- data/plugins/guests/openbsd/cap/insert_public_key.rb +0 -21
- data/plugins/guests/openbsd/cap/mount_nfs_folder.rb +0 -14
- data/plugins/guests/openbsd/cap/remove_public_key.rb +0 -21
- data/plugins/guests/ubuntu/cap/change_host_name.rb +0 -52
- data/templates/guests/fedora/network_dhcp.erb +0 -6
- data/templates/guests/fedora/network_static.erb +0 -16
- data/test/unit/plugins/guests/freebsd/cap/mount_nfs_folder_test.rb +0 -53
- data/test/unit/plugins/guests/ubuntu/cap/change_host_name_test.rb +0 -42
- data/test/unit/templates/guests/fedora/network_dhcp_test.rb +0 -21
- data/test/unit/templates/guests/fedora/network_static6_test.rb +0 -25
- data/test/unit/templates/guests/fedora/network_static_test.rb +0 -71
@@ -6,32 +6,32 @@ module VagrantPlugins
|
|
6
6
|
name "TinyCore Linux guest."
|
7
7
|
description "TinyCore Linux guest support."
|
8
8
|
|
9
|
-
guest(
|
10
|
-
|
9
|
+
guest(:tinycore, :linux) do
|
10
|
+
require_relative "guest"
|
11
11
|
Guest
|
12
12
|
end
|
13
13
|
|
14
|
-
guest_capability(
|
14
|
+
guest_capability(:tinycore, :configure_networks) do
|
15
15
|
require_relative "cap/configure_networks"
|
16
16
|
Cap::ConfigureNetworks
|
17
17
|
end
|
18
18
|
|
19
|
-
guest_capability(
|
19
|
+
guest_capability(:tinycore, :change_host_name) do
|
20
20
|
require_relative "cap/change_host_name"
|
21
21
|
Cap::ChangeHostName
|
22
22
|
end
|
23
23
|
|
24
|
-
guest_capability(
|
24
|
+
guest_capability(:tinycore, :halt) do
|
25
25
|
require_relative "cap/halt"
|
26
26
|
Cap::Halt
|
27
27
|
end
|
28
28
|
|
29
|
-
guest_capability(
|
29
|
+
guest_capability(:tinycore, :rsync_install) do
|
30
30
|
require_relative "cap/rsync"
|
31
31
|
Cap::RSync
|
32
32
|
end
|
33
33
|
|
34
|
-
guest_capability(
|
34
|
+
guest_capability(:tinycore, :mount_nfs_folder) do
|
35
35
|
require_relative "cap/mount_nfs"
|
36
36
|
Cap::MountNFS
|
37
37
|
end
|
@@ -2,7 +2,7 @@ module VagrantPlugins
|
|
2
2
|
module GuestUbuntu
|
3
3
|
class Guest < Vagrant.plugin("2", :guest)
|
4
4
|
def detect?(machine)
|
5
|
-
machine.communicate.test("
|
5
|
+
machine.communicate.test("test -r /etc/os-release && . /etc/os-release && test xubuntu = x$ID")
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
@@ -6,15 +6,10 @@ module VagrantPlugins
|
|
6
6
|
name "Ubuntu guest"
|
7
7
|
description "Ubuntu guest support."
|
8
8
|
|
9
|
-
guest(
|
9
|
+
guest(:ubuntu, :debian) do
|
10
10
|
require_relative "guest"
|
11
11
|
Guest
|
12
12
|
end
|
13
|
-
|
14
|
-
guest_capability("ubuntu", "change_host_name") do
|
15
|
-
require_relative "cap/change_host_name"
|
16
|
-
Cap::ChangeHostName
|
17
|
-
end
|
18
13
|
end
|
19
14
|
end
|
20
15
|
end
|
@@ -8,12 +8,12 @@ module VagrantPlugins
|
|
8
8
|
name "Windows guest."
|
9
9
|
description "Windows guest support."
|
10
10
|
|
11
|
-
config(
|
11
|
+
config(:windows) do
|
12
12
|
require_relative "config"
|
13
13
|
Config
|
14
14
|
end
|
15
15
|
|
16
|
-
guest(
|
16
|
+
guest(:windows) do
|
17
17
|
require_relative "guest"
|
18
18
|
init!
|
19
19
|
Guest
|
@@ -5,6 +5,7 @@ require "set"
|
|
5
5
|
require "vagrant"
|
6
6
|
require "vagrant/config/v2/util"
|
7
7
|
require "vagrant/util/platform"
|
8
|
+
require "vagrant/util/presence"
|
8
9
|
|
9
10
|
require File.expand_path("../vm_provisioner", __FILE__)
|
10
11
|
require File.expand_path("../vm_subvm", __FILE__)
|
@@ -12,6 +13,8 @@ require File.expand_path("../vm_subvm", __FILE__)
|
|
12
13
|
module VagrantPlugins
|
13
14
|
module Kernel_V2
|
14
15
|
class VMConfig < Vagrant.plugin("2", :config)
|
16
|
+
include Vagrant::Util::Presence
|
17
|
+
|
15
18
|
DEFAULT_VM_NAME = :default
|
16
19
|
|
17
20
|
attr_accessor :allowed_synced_folder_types
|
@@ -361,7 +364,11 @@ module VagrantPlugins
|
|
361
364
|
@base_mac = nil if @base_mac == UNSET_VALUE
|
362
365
|
@boot_timeout = 300 if @boot_timeout == UNSET_VALUE
|
363
366
|
@box = nil if @box == UNSET_VALUE
|
364
|
-
|
367
|
+
|
368
|
+
if @box_check_update == UNSET_VALUE
|
369
|
+
@box_check_update = !present?(ENV["VAGRANT_BOX_UPDATE_CHECK_DISABLE"])
|
370
|
+
end
|
371
|
+
|
365
372
|
@box_download_ca_cert = nil if @box_download_ca_cert == UNSET_VALUE
|
366
373
|
@box_download_ca_path = nil if @box_download_ca_path == UNSET_VALUE
|
367
374
|
@box_download_checksum = nil if @box_download_checksum == UNSET_VALUE
|
@@ -7,20 +7,40 @@ Param(
|
|
7
7
|
$Dir = Split-Path $script:MyInvocation.MyCommand.Path
|
8
8
|
. ([System.IO.Path]::Combine($Dir, "utils\write_messages.ps1"))
|
9
9
|
|
10
|
+
# Make sure the exception type is loaded
|
11
|
+
try
|
12
|
+
{
|
13
|
+
# Microsoft.HyperV.PowerShell is present on all versions of Windows with HyperV
|
14
|
+
[void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.HyperV.PowerShell, Culture=neutral, PublicKeyToken=31bf3856ad364e35')
|
15
|
+
# Microsoft.HyperV.PowerShell.Objects is only present on Windows >= 10.0, so this will fail, and we ignore it since the needed exception
|
16
|
+
# type was loaded in Microsoft.HyperV.PowerShell
|
17
|
+
[void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.HyperV.PowerShell.Objects, Culture=neutral, PublicKeyToken=31bf3856ad364e35')
|
18
|
+
} catch {
|
19
|
+
# Empty catch ok, since if we didn't load the types, we will fail in the next block
|
20
|
+
}
|
21
|
+
|
22
|
+
$VmmsPath = if ([environment]::Is64BitProcess) { "$($env:SystemRoot)\System32\vmms.exe" } else { "$($env:SystemRoot)\Sysnative\vmms.exe" }
|
23
|
+
$HyperVVersion = [version](Get-Item $VmmsPath).VersionInfo.ProductVersion
|
10
24
|
|
11
|
-
if($
|
25
|
+
if($HyperVVersion -lt ([version]'10.0')) {
|
12
26
|
$ExceptionType = [Microsoft.HyperV.PowerShell.VirtualizationOperationFailedException]
|
13
27
|
} else {
|
14
28
|
$ExceptionType = [Microsoft.HyperV.PowerShell.VirtualizationException]
|
15
29
|
}
|
16
|
-
|
17
30
|
try {
|
18
31
|
$VM = Get-VM -Id $VmId -ErrorAction "Stop"
|
19
32
|
$State = $VM.state
|
20
33
|
$Status = $VM.status
|
21
|
-
} catch
|
22
|
-
$
|
23
|
-
|
34
|
+
} catch [Exception] {
|
35
|
+
if($_.Exception.GetType() -eq $ExceptionType)
|
36
|
+
{
|
37
|
+
$State = "not_created"
|
38
|
+
$Status = $State
|
39
|
+
}
|
40
|
+
else
|
41
|
+
{
|
42
|
+
throw;
|
43
|
+
}
|
24
44
|
}
|
25
45
|
|
26
46
|
$resultHash = @{
|
@@ -0,0 +1,734 @@
|
|
1
|
+
require 'log4r'
|
2
|
+
|
3
|
+
require "vagrant/util/platform"
|
4
|
+
|
5
|
+
require File.expand_path("../base", __FILE__)
|
6
|
+
|
7
|
+
module VagrantPlugins
|
8
|
+
module ProviderVirtualBox
|
9
|
+
module Driver
|
10
|
+
# Driver for VirtualBox 5.1.x
|
11
|
+
class Version_5_1 < Base
|
12
|
+
def initialize(uuid)
|
13
|
+
super()
|
14
|
+
|
15
|
+
@logger = Log4r::Logger.new("vagrant::provider::virtualbox_5_1")
|
16
|
+
@uuid = uuid
|
17
|
+
end
|
18
|
+
|
19
|
+
def clear_forwarded_ports
|
20
|
+
args = []
|
21
|
+
read_forwarded_ports(@uuid).each do |nic, name, _, _|
|
22
|
+
args.concat(["--natpf#{nic}", "delete", name])
|
23
|
+
end
|
24
|
+
|
25
|
+
execute("modifyvm", @uuid, *args) if !args.empty?
|
26
|
+
end
|
27
|
+
|
28
|
+
def clear_shared_folders
|
29
|
+
info = execute("showvminfo", @uuid, "--machinereadable", retryable: true)
|
30
|
+
info.split("\n").each do |line|
|
31
|
+
if line =~ /^SharedFolderNameMachineMapping\d+="(.+?)"$/
|
32
|
+
execute("sharedfolder", "remove", @uuid, "--name", $1.to_s)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def clonevm(master_id, snapshot_name)
|
38
|
+
machine_name = "temp_clone_#{(Time.now.to_f * 1000.0).to_i}_#{rand(100000)}"
|
39
|
+
args = ["--register", "--name", machine_name]
|
40
|
+
if snapshot_name
|
41
|
+
args += ["--snapshot", snapshot_name, "--options", "link"]
|
42
|
+
end
|
43
|
+
|
44
|
+
execute("clonevm", master_id, *args)
|
45
|
+
return get_machine_id(machine_name)
|
46
|
+
end
|
47
|
+
|
48
|
+
def create_dhcp_server(network, options)
|
49
|
+
execute("dhcpserver", "add", "--ifname", network,
|
50
|
+
"--ip", options[:dhcp_ip],
|
51
|
+
"--netmask", options[:netmask],
|
52
|
+
"--lowerip", options[:dhcp_lower],
|
53
|
+
"--upperip", options[:dhcp_upper],
|
54
|
+
"--enable")
|
55
|
+
end
|
56
|
+
|
57
|
+
def create_host_only_network(options)
|
58
|
+
# Create the interface
|
59
|
+
execute("hostonlyif", "create") =~ /^Interface '(.+?)' was successfully created$/
|
60
|
+
name = $1.to_s
|
61
|
+
|
62
|
+
# Get the IP so we can determine v4 vs v6
|
63
|
+
ip = IPAddr.new(options[:adapter_ip])
|
64
|
+
|
65
|
+
# Configure
|
66
|
+
if ip.ipv4?
|
67
|
+
execute("hostonlyif", "ipconfig", name,
|
68
|
+
"--ip", options[:adapter_ip],
|
69
|
+
"--netmask", options[:netmask])
|
70
|
+
elsif ip.ipv6?
|
71
|
+
execute("hostonlyif", "ipconfig", name,
|
72
|
+
"--ipv6", options[:adapter_ip],
|
73
|
+
"--netmasklengthv6", options[:netmask].to_s)
|
74
|
+
else
|
75
|
+
raise "BUG: Unknown IP type: #{ip.inspect}"
|
76
|
+
end
|
77
|
+
|
78
|
+
# Return the details
|
79
|
+
return {
|
80
|
+
name: name,
|
81
|
+
ip: options[:adapter_ip],
|
82
|
+
netmask: options[:netmask],
|
83
|
+
dhcp: nil
|
84
|
+
}
|
85
|
+
end
|
86
|
+
|
87
|
+
def create_snapshot(machine_id, snapshot_name)
|
88
|
+
execute("snapshot", machine_id, "take", snapshot_name)
|
89
|
+
end
|
90
|
+
|
91
|
+
def delete_snapshot(machine_id, snapshot_name)
|
92
|
+
# Start with 0%
|
93
|
+
last = 0
|
94
|
+
total = ""
|
95
|
+
yield 0 if block_given?
|
96
|
+
|
97
|
+
# Snapshot and report the % progress
|
98
|
+
execute("snapshot", machine_id, "delete", snapshot_name) do |type, data|
|
99
|
+
if type == :stderr
|
100
|
+
# Append the data so we can see the full view
|
101
|
+
total << data.gsub("\r", "")
|
102
|
+
|
103
|
+
# Break up the lines. We can't get the progress until we see an "OK"
|
104
|
+
lines = total.split("\n")
|
105
|
+
|
106
|
+
# The progress of the import will be in the last line. Do a greedy
|
107
|
+
# regular expression to find what we're looking for.
|
108
|
+
match = /.+(\d{2})%/.match(lines.last)
|
109
|
+
if match
|
110
|
+
current = match[1].to_i
|
111
|
+
if current > last
|
112
|
+
last = current
|
113
|
+
yield current if block_given?
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
def list_snapshots(machine_id)
|
121
|
+
output = execute(
|
122
|
+
"snapshot", machine_id, "list", "--machinereadable",
|
123
|
+
retryable: true)
|
124
|
+
|
125
|
+
result = []
|
126
|
+
output.split("\n").each do |line|
|
127
|
+
if line =~ /^SnapshotName.*?="(.+?)"$/i
|
128
|
+
result << $1.to_s
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
result.sort
|
133
|
+
rescue Vagrant::Errors::VBoxManageError => e
|
134
|
+
d = e.extra_data
|
135
|
+
return [] if d[:stderr].include?("does not have") || d[:stdout].include?("does not have")
|
136
|
+
raise
|
137
|
+
end
|
138
|
+
|
139
|
+
def restore_snapshot(machine_id, snapshot_name)
|
140
|
+
# Start with 0%
|
141
|
+
last = 0
|
142
|
+
total = ""
|
143
|
+
yield 0 if block_given?
|
144
|
+
|
145
|
+
execute("snapshot", machine_id, "restore", snapshot_name) do |type, data|
|
146
|
+
if type == :stderr
|
147
|
+
# Append the data so we can see the full view
|
148
|
+
total << data.gsub("\r", "")
|
149
|
+
|
150
|
+
# Break up the lines. We can't get the progress until we see an "OK"
|
151
|
+
lines = total.split("\n")
|
152
|
+
|
153
|
+
# The progress of the import will be in the last line. Do a greedy
|
154
|
+
# regular expression to find what we're looking for.
|
155
|
+
match = /.+(\d{2})%/.match(lines.last)
|
156
|
+
if match
|
157
|
+
current = match[1].to_i
|
158
|
+
if current > last
|
159
|
+
last = current
|
160
|
+
yield current if block_given?
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
def delete
|
168
|
+
execute("unregistervm", @uuid, "--delete")
|
169
|
+
end
|
170
|
+
|
171
|
+
def delete_unused_host_only_networks
|
172
|
+
networks = []
|
173
|
+
execute("list", "hostonlyifs", retryable: true).split("\n").each do |line|
|
174
|
+
networks << $1.to_s if line =~ /^Name:\s+(.+?)$/
|
175
|
+
end
|
176
|
+
|
177
|
+
execute("list", "vms", retryable: true).split("\n").each do |line|
|
178
|
+
if line =~ /^".+?"\s+\{(.+?)\}$/
|
179
|
+
info = execute("showvminfo", $1.to_s, "--machinereadable", retryable: true)
|
180
|
+
info.split("\n").each do |inner_line|
|
181
|
+
if inner_line =~ /^hostonlyadapter\d+="(.+?)"$/
|
182
|
+
networks.delete($1.to_s)
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
networks.each do |name|
|
189
|
+
# First try to remove any DHCP servers attached. We use `raw` because
|
190
|
+
# it is okay if this fails. It usually means that a DHCP server was
|
191
|
+
# never attached.
|
192
|
+
raw("dhcpserver", "remove", "--ifname", name)
|
193
|
+
|
194
|
+
# Delete the actual host only network interface.
|
195
|
+
execute("hostonlyif", "remove", name)
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
def discard_saved_state
|
200
|
+
execute("discardstate", @uuid)
|
201
|
+
end
|
202
|
+
|
203
|
+
def enable_adapters(adapters)
|
204
|
+
args = []
|
205
|
+
adapters.each do |adapter|
|
206
|
+
args.concat(["--nic#{adapter[:adapter]}", adapter[:type].to_s])
|
207
|
+
|
208
|
+
if adapter[:bridge]
|
209
|
+
args.concat(["--bridgeadapter#{adapter[:adapter]}",
|
210
|
+
adapter[:bridge], "--cableconnected#{adapter[:adapter]}", "on"])
|
211
|
+
end
|
212
|
+
|
213
|
+
if adapter[:hostonly]
|
214
|
+
args.concat(["--hostonlyadapter#{adapter[:adapter]}",
|
215
|
+
adapter[:hostonly], "--cableconnected#{adapter[:adapter]}", "on"])
|
216
|
+
end
|
217
|
+
|
218
|
+
if adapter[:intnet]
|
219
|
+
args.concat(["--intnet#{adapter[:adapter]}",
|
220
|
+
adapter[:intnet], "--cableconnected#{adapter[:adapter]}", "on"])
|
221
|
+
end
|
222
|
+
|
223
|
+
if adapter[:mac_address]
|
224
|
+
args.concat(["--macaddress#{adapter[:adapter]}",
|
225
|
+
adapter[:mac_address]])
|
226
|
+
end
|
227
|
+
|
228
|
+
if adapter[:nic_type]
|
229
|
+
args.concat(["--nictype#{adapter[:adapter]}", adapter[:nic_type].to_s])
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
execute("modifyvm", @uuid, *args)
|
234
|
+
end
|
235
|
+
|
236
|
+
def execute_command(command)
|
237
|
+
execute(*command)
|
238
|
+
end
|
239
|
+
|
240
|
+
def export(path)
|
241
|
+
execute("export", @uuid, "--output", path.to_s)
|
242
|
+
end
|
243
|
+
|
244
|
+
def forward_ports(ports)
|
245
|
+
args = []
|
246
|
+
ports.each do |options|
|
247
|
+
pf_builder = [options[:name],
|
248
|
+
options[:protocol] || "tcp",
|
249
|
+
options[:hostip] || "",
|
250
|
+
options[:hostport],
|
251
|
+
options[:guestip] || "",
|
252
|
+
options[:guestport]]
|
253
|
+
|
254
|
+
args.concat(["--natpf#{options[:adapter] || 1}",
|
255
|
+
pf_builder.join(",")])
|
256
|
+
end
|
257
|
+
|
258
|
+
execute("modifyvm", @uuid, *args) if !args.empty?
|
259
|
+
end
|
260
|
+
|
261
|
+
def get_machine_id(machine_name)
|
262
|
+
output = execute("list", "vms", retryable: true)
|
263
|
+
match = /^"#{Regexp.escape(machine_name)}" \{(.+?)\}$/.match(output)
|
264
|
+
return match[1].to_s if match
|
265
|
+
nil
|
266
|
+
end
|
267
|
+
|
268
|
+
def halt
|
269
|
+
execute("controlvm", @uuid, "poweroff")
|
270
|
+
end
|
271
|
+
|
272
|
+
def import(ovf)
|
273
|
+
ovf = Vagrant::Util::Platform.cygwin_windows_path(ovf)
|
274
|
+
|
275
|
+
output = ""
|
276
|
+
total = ""
|
277
|
+
last = 0
|
278
|
+
|
279
|
+
# Dry-run the import to get the suggested name and path
|
280
|
+
@logger.debug("Doing dry-run import to determine parallel-safe name...")
|
281
|
+
output = execute("import", "-n", ovf)
|
282
|
+
result = /Suggested VM name "(.+?)"/.match(output)
|
283
|
+
if !result
|
284
|
+
raise Vagrant::Errors::VirtualBoxNoName, output: output
|
285
|
+
end
|
286
|
+
suggested_name = result[1].to_s
|
287
|
+
|
288
|
+
# Append millisecond plus a random to the path in case we're
|
289
|
+
# importing the same box elsewhere.
|
290
|
+
specified_name = "#{suggested_name}_#{(Time.now.to_f * 1000.0).to_i}_#{rand(100000)}"
|
291
|
+
@logger.debug("-- Parallel safe name: #{specified_name}")
|
292
|
+
|
293
|
+
# Build the specified name param list
|
294
|
+
name_params = [
|
295
|
+
"--vsys", "0",
|
296
|
+
"--vmname", specified_name,
|
297
|
+
]
|
298
|
+
|
299
|
+
# Extract the disks list and build the disk target params
|
300
|
+
disk_params = []
|
301
|
+
disks = output.scan(/(\d+): Hard disk image: source image=.+, target path=(.+),/)
|
302
|
+
disks.each do |unit_num, path|
|
303
|
+
disk_params << "--vsys"
|
304
|
+
disk_params << "0"
|
305
|
+
disk_params << "--unit"
|
306
|
+
disk_params << unit_num
|
307
|
+
disk_params << "--disk"
|
308
|
+
if Vagrant::Util::Platform.windows?
|
309
|
+
# we use the block form of sub here to ensure that if the specified_name happens to end with a number (which is fairly likely) then
|
310
|
+
# we won't end up having the character sequence of a \ followed by a number be interpreted as a back reference. For example, if
|
311
|
+
# specified_name were "abc123", then "\\abc123\\".reverse would be "\\321cba\\", and the \3 would be treated as a back reference by the sub
|
312
|
+
disk_params << path.reverse.sub("\\#{suggested_name}\\".reverse) { "\\#{specified_name}\\".reverse }.reverse # Replace only last occurrence
|
313
|
+
else
|
314
|
+
disk_params << path.reverse.sub("/#{suggested_name}/".reverse, "/#{specified_name}/".reverse).reverse # Replace only last occurrence
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
execute("import", ovf , *name_params, *disk_params) do |type, data|
|
319
|
+
if type == :stdout
|
320
|
+
# Keep track of the stdout so that we can get the VM name
|
321
|
+
output << data
|
322
|
+
elsif type == :stderr
|
323
|
+
# Append the data so we can see the full view
|
324
|
+
total << data.gsub("\r", "")
|
325
|
+
|
326
|
+
# Break up the lines. We can't get the progress until we see an "OK"
|
327
|
+
lines = total.split("\n")
|
328
|
+
if lines.include?("OK.")
|
329
|
+
# The progress of the import will be in the last line. Do a greedy
|
330
|
+
# regular expression to find what we're looking for.
|
331
|
+
match = /.+(\d{2})%/.match(lines.last)
|
332
|
+
if match
|
333
|
+
current = match[1].to_i
|
334
|
+
if current > last
|
335
|
+
last = current
|
336
|
+
yield current if block_given?
|
337
|
+
end
|
338
|
+
end
|
339
|
+
end
|
340
|
+
end
|
341
|
+
end
|
342
|
+
|
343
|
+
return get_machine_id specified_name
|
344
|
+
end
|
345
|
+
|
346
|
+
def max_network_adapters
|
347
|
+
8
|
348
|
+
end
|
349
|
+
|
350
|
+
def read_forwarded_ports(uuid=nil, active_only=false)
|
351
|
+
uuid ||= @uuid
|
352
|
+
|
353
|
+
@logger.debug("read_forward_ports: uuid=#{uuid} active_only=#{active_only}")
|
354
|
+
|
355
|
+
results = []
|
356
|
+
current_nic = nil
|
357
|
+
info = execute("showvminfo", uuid, "--machinereadable", retryable: true)
|
358
|
+
info.split("\n").each do |line|
|
359
|
+
# This is how we find the nic that a FP is attached to,
|
360
|
+
# since this comes first.
|
361
|
+
current_nic = $1.to_i if line =~ /^nic(\d+)=".+?"$/
|
362
|
+
|
363
|
+
# If we care about active VMs only, then we check the state
|
364
|
+
# to verify the VM is running.
|
365
|
+
if active_only && line =~ /^VMState="(.+?)"$/ && $1.to_s != "running"
|
366
|
+
return []
|
367
|
+
end
|
368
|
+
|
369
|
+
# Parse out the forwarded port information
|
370
|
+
if line =~ /^Forwarding.+?="(.+?),.+?,.*?,(.+?),.*?,(.+?)"$/
|
371
|
+
result = [current_nic, $1.to_s, $2.to_i, $3.to_i]
|
372
|
+
@logger.debug(" - #{result.inspect}")
|
373
|
+
results << result
|
374
|
+
end
|
375
|
+
end
|
376
|
+
|
377
|
+
results
|
378
|
+
end
|
379
|
+
|
380
|
+
def read_bridged_interfaces
|
381
|
+
execute("list", "bridgedifs").split("\n\n").collect do |block|
|
382
|
+
info = {}
|
383
|
+
|
384
|
+
block.split("\n").each do |line|
|
385
|
+
if line =~ /^Name:\s+(.+?)$/
|
386
|
+
info[:name] = $1.to_s
|
387
|
+
elsif line =~ /^IPAddress:\s+(.+?)$/
|
388
|
+
info[:ip] = $1.to_s
|
389
|
+
elsif line =~ /^NetworkMask:\s+(.+?)$/
|
390
|
+
info[:netmask] = $1.to_s
|
391
|
+
elsif line =~ /^Status:\s+(.+?)$/
|
392
|
+
info[:status] = $1.to_s
|
393
|
+
end
|
394
|
+
end
|
395
|
+
|
396
|
+
# Return the info to build up the results
|
397
|
+
info
|
398
|
+
end
|
399
|
+
end
|
400
|
+
|
401
|
+
def read_dhcp_servers
|
402
|
+
execute("list", "dhcpservers", retryable: true).split("\n\n").collect do |block|
|
403
|
+
info = {}
|
404
|
+
|
405
|
+
block.split("\n").each do |line|
|
406
|
+
if network = line[/^NetworkName:\s+HostInterfaceNetworking-(.+?)$/, 1]
|
407
|
+
info[:network] = network
|
408
|
+
info[:network_name] = "HostInterfaceNetworking-#{network}"
|
409
|
+
elsif ip = line[/^IP:\s+(.+?)$/, 1]
|
410
|
+
info[:ip] = ip
|
411
|
+
elsif netmask = line[/^NetworkMask:\s+(.+?)$/, 1]
|
412
|
+
info[:netmask] = netmask
|
413
|
+
elsif lower = line[/^lowerIPAddress:\s+(.+?)$/, 1]
|
414
|
+
info[:lower] = lower
|
415
|
+
elsif upper = line[/^upperIPAddress:\s+(.+?)$/, 1]
|
416
|
+
info[:upper] = upper
|
417
|
+
end
|
418
|
+
end
|
419
|
+
|
420
|
+
info
|
421
|
+
end
|
422
|
+
end
|
423
|
+
|
424
|
+
def read_guest_additions_version
|
425
|
+
output = execute("guestproperty", "get", @uuid, "/VirtualBox/GuestAdd/Version",
|
426
|
+
retryable: true)
|
427
|
+
if output =~ /^Value: (.+?)$/
|
428
|
+
# Split the version by _ since some distro versions modify it
|
429
|
+
# to look like this: 4.1.2_ubuntu, and the distro part isn't
|
430
|
+
# too important.
|
431
|
+
value = $1.to_s
|
432
|
+
return value.split("_").first
|
433
|
+
end
|
434
|
+
|
435
|
+
# If we can't get the guest additions version by guest property, try
|
436
|
+
# to get it from the VM info itself.
|
437
|
+
info = execute("showvminfo", @uuid, "--machinereadable", retryable: true)
|
438
|
+
info.split("\n").each do |line|
|
439
|
+
return $1.to_s if line =~ /^GuestAdditionsVersion="(.+?)"$/
|
440
|
+
end
|
441
|
+
|
442
|
+
return nil
|
443
|
+
end
|
444
|
+
|
445
|
+
def read_guest_ip(adapter_number)
|
446
|
+
ip = read_guest_property("/VirtualBox/GuestInfo/Net/#{adapter_number}/V4/IP")
|
447
|
+
if !valid_ip_address?(ip)
|
448
|
+
raise Vagrant::Errors::VirtualBoxGuestPropertyNotFound,
|
449
|
+
guest_property: "/VirtualBox/GuestInfo/Net/#{adapter_number}/V4/IP"
|
450
|
+
end
|
451
|
+
|
452
|
+
return ip
|
453
|
+
end
|
454
|
+
|
455
|
+
def read_guest_property(property)
|
456
|
+
output = execute("guestproperty", "get", @uuid, property)
|
457
|
+
if output =~ /^Value: (.+?)$/
|
458
|
+
$1.to_s
|
459
|
+
else
|
460
|
+
raise Vagrant::Errors::VirtualBoxGuestPropertyNotFound, guest_property: property
|
461
|
+
end
|
462
|
+
end
|
463
|
+
|
464
|
+
def read_host_only_interfaces
|
465
|
+
execute("list", "hostonlyifs", retryable: true).split("\n\n").collect do |block|
|
466
|
+
info = {}
|
467
|
+
|
468
|
+
block.split("\n").each do |line|
|
469
|
+
if line =~ /^Name:\s+(.+?)$/
|
470
|
+
info[:name] = $1.to_s
|
471
|
+
elsif line =~ /^IPAddress:\s+(.+?)$/
|
472
|
+
info[:ip] = $1.to_s
|
473
|
+
elsif line =~ /^NetworkMask:\s+(.+?)$/
|
474
|
+
info[:netmask] = $1.to_s
|
475
|
+
elsif line =~ /^IPV6Address:\s+(.+?)$/
|
476
|
+
info[:ipv6] = $1.to_s.strip
|
477
|
+
elsif line =~ /^IPV6NetworkMaskPrefixLength:\s+(.+?)$/
|
478
|
+
info[:ipv6_prefix] = $1.to_s.strip
|
479
|
+
elsif line =~ /^Status:\s+(.+?)$/
|
480
|
+
info[:status] = $1.to_s
|
481
|
+
end
|
482
|
+
end
|
483
|
+
|
484
|
+
info
|
485
|
+
end
|
486
|
+
end
|
487
|
+
|
488
|
+
def read_mac_address
|
489
|
+
info = execute("showvminfo", @uuid, "--machinereadable", retryable: true)
|
490
|
+
info.split("\n").each do |line|
|
491
|
+
return $1.to_s if line =~ /^macaddress1="(.+?)"$/
|
492
|
+
end
|
493
|
+
|
494
|
+
nil
|
495
|
+
end
|
496
|
+
|
497
|
+
def read_mac_addresses
|
498
|
+
macs = {}
|
499
|
+
info = execute("showvminfo", @uuid, "--machinereadable", retryable: true)
|
500
|
+
info.split("\n").each do |line|
|
501
|
+
if matcher = /^macaddress(\d+)="(.+?)"$/.match(line)
|
502
|
+
adapter = matcher[1].to_i
|
503
|
+
mac = matcher[2].to_s
|
504
|
+
macs[adapter] = mac
|
505
|
+
end
|
506
|
+
end
|
507
|
+
macs
|
508
|
+
end
|
509
|
+
|
510
|
+
def read_machine_folder
|
511
|
+
execute("list", "systemproperties", retryable: true).split("\n").each do |line|
|
512
|
+
if line =~ /^Default machine folder:\s+(.+?)$/i
|
513
|
+
return $1.to_s
|
514
|
+
end
|
515
|
+
end
|
516
|
+
|
517
|
+
nil
|
518
|
+
end
|
519
|
+
|
520
|
+
def read_network_interfaces
|
521
|
+
nics = {}
|
522
|
+
info = execute("showvminfo", @uuid, "--machinereadable", retryable: true)
|
523
|
+
info.split("\n").each do |line|
|
524
|
+
if line =~ /^nic(\d+)="(.+?)"$/
|
525
|
+
adapter = $1.to_i
|
526
|
+
type = $2.to_sym
|
527
|
+
|
528
|
+
nics[adapter] ||= {}
|
529
|
+
nics[adapter][:type] = type
|
530
|
+
elsif line =~ /^hostonlyadapter(\d+)="(.+?)"$/
|
531
|
+
adapter = $1.to_i
|
532
|
+
network = $2.to_s
|
533
|
+
|
534
|
+
nics[adapter] ||= {}
|
535
|
+
nics[adapter][:hostonly] = network
|
536
|
+
elsif line =~ /^bridgeadapter(\d+)="(.+?)"$/
|
537
|
+
adapter = $1.to_i
|
538
|
+
network = $2.to_s
|
539
|
+
|
540
|
+
nics[adapter] ||= {}
|
541
|
+
nics[adapter][:bridge] = network
|
542
|
+
end
|
543
|
+
end
|
544
|
+
|
545
|
+
nics
|
546
|
+
end
|
547
|
+
|
548
|
+
def read_state
|
549
|
+
output = execute("showvminfo", @uuid, "--machinereadable", retryable: true)
|
550
|
+
if output =~ /^name="<inaccessible>"$/
|
551
|
+
return :inaccessible
|
552
|
+
elsif output =~ /^VMState="(.+?)"$/
|
553
|
+
return $1.to_sym
|
554
|
+
end
|
555
|
+
|
556
|
+
nil
|
557
|
+
end
|
558
|
+
|
559
|
+
def read_used_ports
|
560
|
+
ports = []
|
561
|
+
execute("list", "vms", retryable: true).split("\n").each do |line|
|
562
|
+
if line =~ /^".+?" \{(.+?)\}$/
|
563
|
+
uuid = $1.to_s
|
564
|
+
|
565
|
+
# Ignore our own used ports
|
566
|
+
next if uuid == @uuid
|
567
|
+
|
568
|
+
read_forwarded_ports(uuid, true).each do |_, _, hostport, _|
|
569
|
+
ports << hostport
|
570
|
+
end
|
571
|
+
end
|
572
|
+
end
|
573
|
+
|
574
|
+
ports
|
575
|
+
end
|
576
|
+
|
577
|
+
def read_vms
|
578
|
+
results = {}
|
579
|
+
execute("list", "vms", retryable: true).split("\n").each do |line|
|
580
|
+
if line =~ /^"(.+?)" \{(.+?)\}$/
|
581
|
+
results[$1.to_s] = $2.to_s
|
582
|
+
end
|
583
|
+
end
|
584
|
+
|
585
|
+
results
|
586
|
+
end
|
587
|
+
|
588
|
+
def reconfig_host_only(interface)
|
589
|
+
execute("hostonlyif", "ipconfig", interface[:name],
|
590
|
+
"--ipv6", interface[:ipv6])
|
591
|
+
end
|
592
|
+
|
593
|
+
def remove_dhcp_server(network_name)
|
594
|
+
execute("dhcpserver", "remove", "--netname", network_name)
|
595
|
+
end
|
596
|
+
|
597
|
+
def set_mac_address(mac)
|
598
|
+
execute("modifyvm", @uuid, "--macaddress1", mac)
|
599
|
+
end
|
600
|
+
|
601
|
+
def set_name(name)
|
602
|
+
execute("modifyvm", @uuid, "--name", name, retryable: true)
|
603
|
+
rescue Vagrant::Errors::VBoxManageError => e
|
604
|
+
raise if !e.extra_data[:stderr].include?("VERR_ALREADY_EXISTS")
|
605
|
+
|
606
|
+
# We got VERR_ALREADY_EXISTS. This means that we're renaming to
|
607
|
+
# a VM name that already exists. Raise a custom error.
|
608
|
+
raise Vagrant::Errors::VirtualBoxNameExists,
|
609
|
+
stderr: e.extra_data[:stderr]
|
610
|
+
end
|
611
|
+
|
612
|
+
def share_folders(folders)
|
613
|
+
folders.each do |folder|
|
614
|
+
hostpath = folder[:hostpath]
|
615
|
+
if Vagrant::Util::Platform.windows?
|
616
|
+
hostpath = Vagrant::Util::Platform.windows_unc_path(hostpath)
|
617
|
+
end
|
618
|
+
args = ["--name",
|
619
|
+
folder[:name],
|
620
|
+
"--hostpath",
|
621
|
+
hostpath]
|
622
|
+
args << "--transient" if folder.key?(:transient) && folder[:transient]
|
623
|
+
|
624
|
+
# Enable symlinks on the shared folder
|
625
|
+
execute("setextradata", @uuid, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/#{folder[:name]}", "1")
|
626
|
+
|
627
|
+
# Add the shared folder
|
628
|
+
execute("sharedfolder", "add", @uuid, *args)
|
629
|
+
end
|
630
|
+
end
|
631
|
+
|
632
|
+
def ssh_port(expected_port)
|
633
|
+
@logger.debug("Searching for SSH port: #{expected_port.inspect}")
|
634
|
+
|
635
|
+
# Look for the forwarded port only by comparing the guest port
|
636
|
+
read_forwarded_ports.each do |_, _, hostport, guestport|
|
637
|
+
return hostport if guestport == expected_port
|
638
|
+
end
|
639
|
+
|
640
|
+
nil
|
641
|
+
end
|
642
|
+
|
643
|
+
def resume
|
644
|
+
@logger.debug("Resuming paused VM...")
|
645
|
+
execute("controlvm", @uuid, "resume")
|
646
|
+
end
|
647
|
+
|
648
|
+
def start(mode)
|
649
|
+
command = ["startvm", @uuid, "--type", mode.to_s]
|
650
|
+
r = raw(*command)
|
651
|
+
|
652
|
+
if r.exit_code == 0 || r.stdout =~ /VM ".+?" has been successfully started/
|
653
|
+
# Some systems return an exit code 1 for some reason. For that
|
654
|
+
# we depend on the output.
|
655
|
+
return true
|
656
|
+
end
|
657
|
+
|
658
|
+
# If we reached this point then it didn't work out.
|
659
|
+
raise Vagrant::Errors::VBoxManageError,
|
660
|
+
command: command.inspect,
|
661
|
+
stderr: r.stderr
|
662
|
+
end
|
663
|
+
|
664
|
+
def suspend
|
665
|
+
execute("controlvm", @uuid, "savestate")
|
666
|
+
end
|
667
|
+
|
668
|
+
def unshare_folders(names)
|
669
|
+
names.each do |name|
|
670
|
+
begin
|
671
|
+
execute(
|
672
|
+
"sharedfolder", "remove", @uuid,
|
673
|
+
"--name", name,
|
674
|
+
"--transient")
|
675
|
+
|
676
|
+
execute(
|
677
|
+
"setextradata", @uuid,
|
678
|
+
"VBoxInternal2/SharedFoldersEnableSymlinksCreate/#{name}")
|
679
|
+
rescue Vagrant::Errors::VBoxManageError => e
|
680
|
+
if e.extra_data[:stderr].include?("VBOX_E_FILE_ERROR")
|
681
|
+
# The folder doesn't exist. ignore.
|
682
|
+
else
|
683
|
+
raise
|
684
|
+
end
|
685
|
+
end
|
686
|
+
end
|
687
|
+
end
|
688
|
+
|
689
|
+
def verify!
|
690
|
+
# This command sometimes fails if kernel drivers aren't properly loaded
|
691
|
+
# so we just run the command and verify that it succeeded.
|
692
|
+
execute("list", "hostonlyifs", retryable: true)
|
693
|
+
end
|
694
|
+
|
695
|
+
def verify_image(path)
|
696
|
+
r = raw("import", path.to_s, "--dry-run")
|
697
|
+
return r.exit_code == 0
|
698
|
+
end
|
699
|
+
|
700
|
+
def vm_exists?(uuid)
|
701
|
+
5.times do |i|
|
702
|
+
result = raw("showvminfo", uuid)
|
703
|
+
return true if result.exit_code == 0
|
704
|
+
|
705
|
+
# If vboxmanage returned VBOX_E_OBJECT_NOT_FOUND,
|
706
|
+
# then the vm truly does not exist. Any other error might be transient
|
707
|
+
return false if result.stderr.include?("VBOX_E_OBJECT_NOT_FOUND")
|
708
|
+
|
709
|
+
# Sleep a bit though to give VirtualBox time to fix itself
|
710
|
+
sleep 2
|
711
|
+
end
|
712
|
+
|
713
|
+
# If we reach this point, it means that we consistently got the
|
714
|
+
# failure, do a standard vboxmanage now. This will raise an
|
715
|
+
# exception if it fails again.
|
716
|
+
execute("showvminfo", uuid)
|
717
|
+
return true
|
718
|
+
end
|
719
|
+
|
720
|
+
protected
|
721
|
+
|
722
|
+
def valid_ip_address?(ip)
|
723
|
+
# Filter out invalid IP addresses
|
724
|
+
# GH-4658 VirtualBox can report an IP address of 0.0.0.0 for FreeBSD guests.
|
725
|
+
if ip == "0.0.0.0"
|
726
|
+
return false
|
727
|
+
else
|
728
|
+
return true
|
729
|
+
end
|
730
|
+
end
|
731
|
+
end
|
732
|
+
end
|
733
|
+
end
|
734
|
+
end
|