vagrant-unbundled 1.8.1.2 → 1.8.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -13
- data/.travis.yml +3 -0
- data/CHANGELOG.md +167 -4
- data/LICENSE +1 -1
- data/README.md +7 -9
- data/RELEASE.md +28 -0
- data/bin/vagrant +1 -1
- data/contrib/bash/completion.sh +6 -1
- data/contrib/sudoers/linux-fedora +1 -1
- data/keys/README.md +1 -1
- data/lib/vagrant/action/builtin/box_add.rb +7 -3
- data/lib/vagrant/action/general/package.rb +47 -13
- data/lib/vagrant/box.rb +1 -1
- data/lib/vagrant/box_collection.rb +3 -4
- data/lib/vagrant/bundler.rb +29 -11
- data/lib/vagrant/machine.rb +14 -5
- data/lib/vagrant/ui.rb +1 -1
- data/lib/vagrant/util/is_port_open.rb +1 -1
- data/lib/vagrant/util/platform.rb +67 -42
- data/plugins/commands/box/command/remove.rb +1 -1
- data/plugins/commands/box/command/update.rb +10 -0
- data/plugins/commands/destroy/command.rb +1 -1
- data/plugins/commands/halt/command.rb +1 -1
- data/plugins/commands/init/command.rb +8 -2
- data/plugins/commands/login/client.rb +19 -1
- data/plugins/commands/package/command.rb +1 -1
- data/plugins/commands/plugin/command/mixin_install_opts.rb +1 -1
- data/plugins/commands/plugin/gem_helper.rb +1 -1
- data/plugins/commands/port/command.rb +1 -1
- data/plugins/commands/rdp/command.rb +1 -1
- data/plugins/commands/resume/command.rb +15 -1
- data/plugins/commands/snapshot/command/pop.rb +16 -1
- data/plugins/commands/snapshot/command/push_shared.rb +7 -9
- data/plugins/commands/snapshot/command/restore.rb +14 -1
- data/plugins/commands/ssh/command.rb +2 -1
- data/plugins/commands/ssh_config/command.rb +1 -1
- data/plugins/commands/status/command.rb +1 -1
- data/plugins/commands/suspend/command.rb +1 -1
- data/plugins/commands/up/command.rb +4 -4
- data/plugins/communicators/ssh/communicator.rb +2 -2
- data/plugins/communicators/winrm/communicator.rb +11 -11
- data/plugins/communicators/winrm/config.rb +7 -1
- data/plugins/communicators/winrm/shell.rb +41 -41
- data/plugins/guests/amazon/cap/flavor.rb +14 -0
- data/plugins/guests/amazon/guest.rb +9 -0
- data/plugins/guests/amazon/plugin.rb +20 -0
- data/plugins/guests/arch/cap/change_host_name.rb +15 -6
- data/plugins/guests/arch/cap/configure_networks.rb +33 -14
- data/plugins/guests/arch/plugin.rb +1 -1
- data/plugins/guests/atomic/cap/change_host_name.rb +16 -1
- data/plugins/guests/atomic/plugin.rb +2 -2
- data/plugins/guests/coreos/cap/change_host_name.rb +10 -4
- data/plugins/guests/coreos/cap/configure_networks.rb +49 -37
- data/plugins/guests/coreos/guest.rb +2 -0
- data/plugins/guests/coreos/plugin.rb +1 -1
- data/plugins/guests/darwin/cap/change_host_name.rb +25 -7
- data/plugins/guests/darwin/cap/choose_addressable_ip_addr.rb +7 -7
- data/plugins/guests/darwin/cap/insert_public_key.rb +19 -7
- data/plugins/guests/darwin/guest.rb +1 -1
- data/plugins/guests/darwin/plugin.rb +1 -1
- data/plugins/guests/debian/cap/change_host_name.rb +37 -84
- data/plugins/guests/debian/cap/configure_networks.rb +61 -46
- data/plugins/guests/debian/cap/nfs_client.rb +5 -4
- data/plugins/guests/debian/cap/rsync.rb +6 -3
- data/plugins/guests/debian/cap/smb.rb +6 -7
- data/plugins/guests/debian/guest.rb +2 -0
- data/plugins/guests/debian/plugin.rb +1 -1
- data/plugins/guests/fedora/cap/change_host_name.rb +18 -64
- data/plugins/guests/fedora/cap/configure_networks.rb +10 -9
- data/plugins/guests/fedora/plugin.rb +1 -1
- data/plugins/guests/freebsd/cap/change_host_name.rb +21 -3
- data/plugins/guests/freebsd/cap/configure_networks.rb +45 -30
- data/plugins/guests/freebsd/cap/halt.rb +1 -1
- data/plugins/guests/freebsd/cap/insert_public_key.rb +21 -8
- data/plugins/guests/freebsd/cap/mount_nfs_folder.rb +10 -7
- data/plugins/guests/freebsd/cap/rsync.rb +1 -11
- data/plugins/guests/freebsd/plugin.rb +1 -1
- data/plugins/guests/funtoo/cap/configure_networks.rb +10 -6
- data/plugins/guests/gentoo/cap/configure_networks.rb +9 -8
- data/plugins/guests/linux/cap/choose_addressable_ip_addr.rb +6 -6
- data/plugins/guests/linux/cap/insert_public_key.rb +18 -8
- data/plugins/guests/linux/cap/mount_nfs.rb +16 -12
- data/plugins/guests/linux/cap/mount_smb_shared_folder.rb +2 -2
- data/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb +1 -1
- data/plugins/guests/linux/guest.rb +0 -2
- data/plugins/guests/linux/plugin.rb +1 -1
- data/plugins/guests/mint/guest.rb +0 -2
- data/plugins/guests/mint/plugin.rb +1 -1
- data/plugins/guests/netbsd/cap/configure_networks.rb +8 -8
- data/plugins/guests/nixos/cap/change_host_name.rb +11 -8
- data/plugins/guests/nixos/cap/configure_networks.rb +12 -9
- data/plugins/guests/omnios/cap/change_host_name.rb +17 -5
- data/plugins/guests/omnios/cap/mount_nfs_folder.rb +10 -4
- data/plugins/guests/omnios/cap/rsync.rb +11 -0
- data/plugins/guests/omnios/guest.rb +0 -2
- data/plugins/guests/omnios/plugin.rb +6 -1
- data/plugins/guests/openbsd/cap/configure_networks.rb +8 -6
- data/plugins/guests/photon/cap/change_host_name.rb +17 -4
- data/plugins/guests/photon/cap/configure_networks.rb +14 -26
- data/plugins/guests/photon/guest.rb +1 -1
- data/plugins/guests/photon/plugin.rb +12 -12
- data/plugins/guests/pld/cap/change_host_name.rb +21 -9
- data/plugins/guests/pld/guest.rb +0 -2
- data/plugins/guests/pld/plugin.rb +1 -1
- data/plugins/guests/redhat/cap/change_host_name.rb +30 -96
- data/plugins/guests/redhat/cap/configure_networks.rb +44 -50
- data/plugins/guests/redhat/cap/flavor.rb +3 -4
- data/plugins/guests/redhat/cap/nfs_client.rb +13 -25
- data/plugins/guests/redhat/cap/rsync.rb +6 -6
- data/plugins/guests/redhat/guest.rb +0 -2
- data/plugins/guests/redhat/plugin.rb +1 -10
- data/plugins/guests/slackware/cap/change_host_name.rb +19 -8
- data/plugins/guests/slackware/cap/configure_networks.rb +30 -14
- data/plugins/guests/slackware/guest.rb +0 -2
- data/plugins/guests/slackware/plugin.rb +1 -1
- data/plugins/guests/smartos/config.rb +3 -15
- data/plugins/guests/suse/cap/change_host_name.rb +15 -7
- data/plugins/guests/suse/cap/configure_networks.rb +31 -37
- data/plugins/guests/suse/cap/nfs_client.rb +5 -6
- data/plugins/guests/suse/cap/rsync.rb +1 -3
- data/plugins/guests/suse/guest.rb +0 -2
- data/plugins/guests/suse/plugin.rb +1 -1
- data/plugins/guests/tinycore/cap/mount_nfs.rb +46 -0
- data/plugins/guests/tinycore/plugin.rb +5 -0
- data/plugins/guests/trisquel/guest.rb +9 -0
- data/plugins/guests/trisquel/plugin.rb +15 -0
- data/plugins/guests/ubuntu/cap/change_host_name.rb +42 -41
- data/plugins/guests/ubuntu/guest.rb +0 -2
- data/plugins/guests/ubuntu/plugin.rb +1 -3
- data/plugins/guests/windows/guest_network.rb +1 -1
- data/plugins/hosts/arch/cap/nfs.rb +3 -19
- data/plugins/hosts/darwin/cap/provider_install_virtualbox.rb +4 -5
- data/plugins/hosts/darwin/cap/rdp.rb +34 -6
- data/plugins/hosts/gentoo/cap/nfs.rb +1 -1
- data/plugins/hosts/windows/cap/provider_install_virtualbox.rb +4 -5
- data/plugins/hosts/windows/cap/ps.rb +2 -2
- data/plugins/hosts/windows/cap/rdp.rb +8 -17
- data/plugins/kernel_v2/config/ssh_connect.rb +6 -0
- data/plugins/kernel_v2/config/vm.rb +3 -1
- data/plugins/providers/docker/action.rb +3 -3
- data/plugins/providers/docker/action/create.rb +1 -1
- data/plugins/providers/docker/command/exec.rb +104 -0
- data/plugins/providers/docker/config.rb +9 -1
- data/plugins/providers/docker/errors.rb +4 -0
- data/plugins/providers/docker/plugin.rb +6 -0
- data/plugins/providers/docker/provider.rb +1 -2
- data/plugins/providers/hyperv/action.rb +56 -1
- data/plugins/providers/hyperv/action/import.rb +13 -5
- data/plugins/providers/hyperv/action/snapshot_delete.rb +27 -0
- data/plugins/providers/hyperv/action/snapshot_restore.rb +23 -0
- data/plugins/providers/hyperv/action/snapshot_save.rb +27 -0
- data/plugins/providers/hyperv/cap/snapshot_list.rb +11 -0
- data/plugins/providers/hyperv/config.rb +5 -2
- data/plugins/providers/hyperv/driver.rb +18 -1
- data/plugins/providers/hyperv/plugin.rb +5 -0
- data/plugins/providers/hyperv/scripts/clone_vhd.ps1 +9 -0
- data/plugins/providers/hyperv/scripts/create_snapshot.ps1 +8 -0
- data/plugins/providers/hyperv/scripts/delete_snapshot.ps1 +8 -0
- data/plugins/providers/hyperv/scripts/get_vm_status.ps1 +8 -2
- data/plugins/providers/hyperv/scripts/import_vm.ps1 +5 -1
- data/plugins/providers/hyperv/scripts/list_snapshots.ps1 +12 -0
- data/plugins/providers/hyperv/scripts/restore_snapshot.ps1 +8 -0
- data/plugins/providers/virtualbox/action.rb +9 -4
- data/plugins/providers/virtualbox/action/import_master.rb +81 -75
- data/plugins/providers/virtualbox/action/package.rb +1 -29
- data/plugins/providers/virtualbox/action/package_setup_files.rb +51 -0
- data/plugins/providers/virtualbox/action/package_setup_folders.rb +38 -0
- data/plugins/providers/virtualbox/action/prepare_nfs_settings.rb +23 -1
- data/plugins/providers/virtualbox/action/setup_package_files.rb +9 -43
- data/plugins/providers/virtualbox/driver/version_4_1.rb +104 -6
- data/plugins/providers/virtualbox/driver/version_4_2.rb +6 -5
- data/plugins/providers/virtualbox/driver/version_4_3.rb +6 -5
- data/plugins/providers/virtualbox/driver/version_5_0.rb +6 -5
- data/plugins/provisioners/ansible/cap/guest/arch/ansible_install.rb +8 -3
- data/plugins/provisioners/ansible/cap/guest/debian/ansible_install.rb +26 -4
- data/plugins/provisioners/ansible/cap/guest/facts.rb +24 -0
- data/plugins/provisioners/ansible/cap/guest/fedora/ansible_install.rb +16 -6
- data/plugins/provisioners/ansible/cap/guest/freebsd/ansible_install.rb +7 -2
- data/plugins/provisioners/ansible/cap/guest/pip/pip.rb +28 -0
- data/plugins/provisioners/ansible/cap/guest/posix/ansible_installed.rb +1 -1
- data/plugins/provisioners/ansible/cap/guest/redhat/ansible_install.rb +24 -7
- data/plugins/provisioners/ansible/cap/guest/suse/ansible_install.rb +6 -2
- data/plugins/provisioners/ansible/cap/guest/ubuntu/ansible_install.rb +17 -6
- data/plugins/provisioners/ansible/config/base.rb +15 -23
- data/plugins/provisioners/ansible/config/guest.rb +9 -22
- data/plugins/provisioners/ansible/config/host.rb +9 -19
- data/plugins/provisioners/ansible/errors.rb +4 -0
- data/plugins/provisioners/ansible/helpers.rb +4 -24
- data/plugins/provisioners/ansible/provisioner/base.rb +58 -10
- data/plugins/provisioners/ansible/provisioner/guest.rb +55 -22
- data/plugins/provisioners/ansible/provisioner/host.rb +50 -9
- data/plugins/provisioners/chef/cap/linux/chef_installed.rb +2 -2
- data/plugins/provisioners/chef/cap/omnios/chef_installed.rb +3 -3
- data/plugins/provisioners/chef/cap/redhat/chef_install.rb +7 -11
- data/plugins/provisioners/chef/cap/suse/chef_install.rb +27 -0
- data/plugins/provisioners/chef/cap/windows/chef_installed.rb +1 -1
- data/plugins/provisioners/chef/command_builder.rb +1 -0
- data/plugins/provisioners/chef/config/base.rb +5 -6
- data/plugins/provisioners/chef/config/chef_solo.rb +6 -0
- data/plugins/provisioners/chef/installer.rb +2 -2
- data/plugins/provisioners/chef/omnibus.rb +1 -1
- data/plugins/provisioners/chef/plugin.rb +5 -0
- data/plugins/provisioners/chef/provisioner/base.rb +52 -56
- data/plugins/provisioners/chef/provisioner/chef_apply.rb +9 -10
- data/plugins/provisioners/chef/provisioner/chef_client.rb +1 -1
- data/plugins/provisioners/chef/provisioner/chef_solo.rb +1 -0
- data/plugins/provisioners/docker/client.rb +22 -4
- data/plugins/provisioners/puppet/provisioner/puppet.rb +3 -3
- data/plugins/provisioners/salt/provisioner.rb +19 -24
- data/plugins/pushes/ftp/adapter.rb +18 -1
- data/plugins/pushes/heroku/locales/en.yml +1 -1
- data/plugins/synced_folders/rsync/helper.rb +1 -1
- data/templates/commands/init/Vagrantfile.erb +6 -3
- data/templates/commands/init/Vagrantfile.min.erb +1 -1
- data/templates/commands/ssh_config/config.erb +5 -1
- data/templates/guests/debian/network_dhcp.erb +2 -2
- data/templates/guests/debian/network_static.erb +2 -2
- data/templates/guests/debian/network_static6.erb +2 -2
- data/templates/guests/fedora/network_static6.erb +9 -0
- data/templates/guests/freebsd/network_dhcp.erb +2 -1
- data/templates/guests/freebsd/network_static.erb +1 -1
- data/templates/guests/slackware/network_dhcp.erb +8 -20
- data/templates/guests/slackware/network_static.erb +10 -22
- data/templates/guests/suse/network_dhcp.erb +1 -1
- data/templates/guests/suse/network_static.erb +3 -3
- data/templates/locales/en.yml +35 -18
- data/templates/locales/providers_docker.yml +8 -0
- data/templates/provisioners/chef_solo/solo.erb +7 -7
- data/test/support/isolated_environment.rb +1 -1
- data/test/unit/base.rb +9 -1
- data/test/unit/plugins/commands/box/command/update_test.rb +7 -1
- data/test/unit/plugins/commands/init/command_test.rb +86 -0
- data/test/unit/plugins/commands/login/client_test.rb +7 -0
- data/test/unit/plugins/commands/ssh_config/command_test.rb +2 -14
- data/test/unit/plugins/communicators/winrm/shell_test.rb +40 -16
- data/test/unit/plugins/guests/amazon/cap/flavor_test.rb +19 -0
- data/test/unit/plugins/guests/arch/cap/change_host_name_test.rb +38 -0
- data/test/unit/plugins/guests/arch/cap/configure_networks_test.rb +55 -0
- data/test/unit/plugins/guests/atomic/cap/change_host_name_test.rb +38 -0
- data/test/unit/plugins/guests/atomic/cap/docker_test.rb +28 -0
- data/test/unit/plugins/guests/coreos/cap/change_host_name_test.rb +37 -0
- data/test/unit/plugins/guests/coreos/cap/configure_networks_test.rb +59 -0
- data/test/unit/plugins/guests/coreos/cap/docker_test.rb +28 -0
- data/test/unit/plugins/guests/darwin/cap/change_host_name_test.rb +40 -0
- data/test/unit/plugins/guests/darwin/cap/choose_addressable_ip_addr_test.rb +36 -0
- data/test/unit/plugins/guests/debian/cap/change_host_name_test.rb +23 -16
- data/test/unit/plugins/guests/debian/cap/configure_networks_test.rb +54 -0
- data/test/unit/plugins/guests/debian/cap/nfs_client_test.rb +30 -0
- data/test/unit/plugins/guests/debian/cap/rsync_test.rb +38 -0
- data/test/unit/plugins/guests/debian/cap/smb_test.rb +38 -0
- data/test/unit/plugins/guests/freebsd/cap/change_host_name_test.rb +40 -0
- data/test/unit/plugins/guests/freebsd/cap/configure_networks_test.rb +51 -0
- data/test/unit/plugins/guests/freebsd/cap/halt_test.rb +35 -0
- data/test/unit/plugins/guests/freebsd/cap/insert_public_key_test.rb +31 -0
- data/test/unit/plugins/guests/freebsd/cap/mount_nfs_folder_test.rb +53 -0
- data/test/unit/plugins/guests/freebsd/cap/rsync_test.rb +46 -0
- data/test/unit/plugins/guests/linux/cap/choose_addressable_ip_addr_test.rb +38 -0
- data/test/unit/plugins/guests/linux/cap/halt_test.rb +36 -0
- data/test/unit/plugins/guests/linux/cap/insert_public_key_test.rb +32 -0
- data/test/unit/plugins/guests/linux/cap/mount_nfs_test.rb +78 -0
- data/test/unit/plugins/guests/linux/cap/mount_shared_folder_test.rb +1 -1
- data/test/unit/plugins/guests/linux/cap/nfs_client_test.rb +29 -0
- data/test/unit/plugins/guests/linux/cap/port_test.rb +30 -0
- data/test/unit/plugins/guests/omnios/cap/change_host_name_test.rb +41 -0
- data/test/unit/plugins/guests/omnios/cap/mount_nfs_folder_test.rb +47 -0
- data/test/unit/plugins/guests/omnios/cap/rsync_test.rb +29 -0
- data/test/unit/plugins/guests/photon/cap/change_host_name_test.rb +26 -18
- data/test/unit/plugins/guests/photon/cap/configure_networks_test.rb +37 -26
- data/test/unit/plugins/guests/photon/cap/docker_test.rb +17 -12
- data/test/unit/plugins/guests/pld/cap/change_host_name_test.rb +39 -0
- data/test/unit/plugins/guests/pld/cap/flavor_test.rb +21 -0
- data/test/unit/plugins/guests/pld/cap/network_scripts_dir_test.rb +21 -0
- data/test/unit/plugins/guests/redhat/cap/change_host_name_test.rb +23 -51
- data/test/unit/plugins/guests/redhat/cap/configure_networks_test.rb +80 -0
- data/test/unit/plugins/guests/redhat/cap/flavor_test.rb +40 -0
- data/test/unit/plugins/guests/redhat/cap/network_scripts_dir_test.rb +21 -0
- data/test/unit/plugins/guests/redhat/cap/nfs_client_test.rb +30 -0
- data/test/unit/plugins/guests/redhat/cap/rsync_test.rb +29 -0
- data/test/unit/plugins/guests/slackware/cap/change_host_name_test.rb +40 -0
- data/test/unit/plugins/guests/slackware/cap/configure_networks_test.rb +48 -0
- data/test/unit/plugins/guests/smartos/cap/change_host_name_test.rb +2 -2
- data/test/unit/plugins/guests/smartos/cap/configure_networks_test.rb +1 -1
- data/test/unit/plugins/guests/smartos/cap/halt_test.rb +1 -1
- data/test/unit/plugins/guests/smartos/cap/mount_nfs_test.rb +1 -1
- data/test/unit/plugins/guests/smartos/cap/rsync_test.rb +1 -1
- data/test/unit/plugins/guests/suse/cap/change_host_name_test.rb +40 -0
- data/test/unit/plugins/guests/suse/cap/configure_networks_test.rb +60 -0
- data/test/unit/plugins/guests/suse/cap/halt_test.rb +36 -0
- data/test/unit/plugins/guests/suse/cap/network_scripts_dir_test.rb +19 -0
- data/test/unit/plugins/guests/suse/cap/nfs_client_test.rb +31 -0
- data/test/unit/plugins/guests/suse/cap/rsync_test.rb +38 -0
- data/test/unit/plugins/guests/tinycore/cap/change_host_name_test.rb +1 -1
- data/test/unit/plugins/guests/ubuntu/cap/change_host_name_test.rb +24 -16
- data/test/unit/plugins/guests/windows/cap/change_host_name_test.rb +1 -1
- data/test/unit/plugins/guests/windows/cap/halt_test.rb +1 -1
- data/test/unit/plugins/guests/windows/cap/mount_shared_folder_test.rb +1 -1
- data/test/unit/plugins/guests/windows/cap/reboot_test.rb +1 -1
- data/test/unit/plugins/guests/windows/cap/rsync_test.rb +1 -1
- data/test/unit/plugins/hosts/darwin/cap/rdp_test.rb +36 -0
- data/test/unit/plugins/kernel_v2/config/vm_test.rb +27 -1
- data/test/unit/plugins/providers/docker/action/create_test.rb +55 -0
- data/test/unit/plugins/providers/docker/command/exec_test.rb +44 -0
- data/test/unit/plugins/providers/docker/config_test.rb +7 -2
- data/test/unit/plugins/providers/virtualbox/action/prepare_nfs_settings_test.rb +18 -0
- data/test/unit/plugins/provisioners/ansible/config/guest_test.rb +83 -0
- data/test/unit/plugins/provisioners/ansible/config/host_test.rb +98 -0
- data/test/unit/plugins/provisioners/ansible/config/shared.rb +107 -0
- data/test/unit/plugins/provisioners/ansible/provisioner_test.rb +82 -10
- data/test/unit/plugins/provisioners/chef/config/base_test.rb +2 -2
- data/test/unit/plugins/provisioners/chef/provisioner/base_test.rb +29 -0
- data/test/unit/plugins/pushes/atlas/push_test.rb +12 -8
- data/test/unit/plugins/pushes/ftp/adapter_test.rb +1 -1
- data/test/unit/plugins/pushes/ftp/push_test.rb +5 -4
- data/test/unit/support/isolated_environment.rb +4 -4
- data/test/unit/support/shared/base_context.rb +11 -3
- data/test/unit/templates/guests/arch/network_dhcp_test.rb +2 -2
- data/test/unit/templates/guests/arch/network_static_test.rb +4 -4
- data/test/unit/templates/guests/debian/network_dhcp_test.rb +6 -6
- data/test/unit/templates/guests/debian/network_static_test.rb +6 -6
- data/test/unit/templates/guests/fedora/network_static6_test.rb +25 -0
- data/test/unit/templates/guests/freebsd/network_dhcp_test.rb +5 -2
- data/test/unit/templates/guests/freebsd/network_static_test.rb +13 -17
- data/test/unit/templates/guests/suse/network_dhcp_test.rb +2 -2
- data/test/unit/templates/guests/suse/network_static_test.rb +4 -4
- data/test/unit/vagrant/action/builtin/box_add_test.rb +33 -31
- data/test/unit/vagrant/action/builtin/lock_test.rb +5 -2
- data/test/unit/vagrant/action/builtin/mixin_synced_folders_test.rb +6 -2
- data/test/unit/vagrant/action/builtin/synced_folder_cleanup_test.rb +5 -1
- data/test/unit/vagrant/action/builtin/synced_folders_test.rb +5 -1
- data/test/unit/vagrant/box_collection_test.rb +19 -7
- data/test/unit/vagrant/box_test.rb +13 -2
- data/test/unit/vagrant/config_test.rb +1 -1
- data/test/unit/vagrant/environment_test.rb +16 -12
- data/test/unit/vagrant/machine_index_test.rb +5 -1
- data/test/unit/vagrant/machine_test.rb +5 -1
- data/test/unit/vagrant/plugin/manager_test.rb +1 -5
- data/test/unit/vagrant/plugin/state_file_test.rb +1 -5
- data/test/unit/vagrant/util/platform_test.rb +5 -0
- data/test/unit/vagrant/util/safe_chdir_test.rb +11 -5
- data/test/unit/vagrant/vagrantfile_test.rb +5 -1
- data/vagrant.gemspec +8 -3
- data/version.txt +1 -1
- metadata +3657 -12
- data/CONTRIBUTING.md +0 -41
- data/test/unit/plugins/guests/support/shared/debian_like_host_name_examples.rb +0 -106
- data/test/unit/plugins/guests/support/shared/redhat_like_host_name_examples.rb +0 -252
- data/test/unit/plugins/provisioners/ansible/config_test.rb +0 -224
@@ -1,75 +1,81 @@
|
|
1
|
-
require "log4r"
|
2
|
-
|
3
|
-
require "digest/md5"
|
4
|
-
|
5
|
-
module VagrantPlugins
|
6
|
-
module ProviderVirtualBox
|
7
|
-
module Action
|
8
|
-
class ImportMaster
|
9
|
-
def initialize(app, env)
|
10
|
-
@app = app
|
11
|
-
@logger = Log4r::Logger.new("vagrant::action::vm::create_master")
|
12
|
-
end
|
13
|
-
|
14
|
-
def call(env)
|
15
|
-
# If we don't have a box, nothing to do
|
16
|
-
if !env[:machine].box
|
17
|
-
return @app.call(env)
|
18
|
-
end
|
19
|
-
|
20
|
-
# Do the import while locked so that nobody else imports
|
21
|
-
# a master at the same time. This is a no-op if we already
|
22
|
-
# have a master that exists.
|
23
|
-
lock_key = Digest::MD5.hexdigest(env[:machine].box.name)
|
24
|
-
env[:machine].env.lock(lock_key, retry: true) do
|
25
|
-
import_master(env)
|
26
|
-
end
|
27
|
-
|
28
|
-
# If we got interrupted, then the import could have been
|
29
|
-
# interrupted and its not a big deal. Just return out.
|
30
|
-
if env[:interrupted]
|
31
|
-
@logger.info("Import of master VM was interrupted -> exiting.")
|
32
|
-
return
|
33
|
-
end
|
34
|
-
|
35
|
-
# Import completed successfully. Continue the chain
|
36
|
-
@app.call(env)
|
37
|
-
end
|
38
|
-
|
39
|
-
protected
|
40
|
-
|
41
|
-
def import_master(env)
|
42
|
-
master_id_file = env[:machine].box.directory.join("master_id")
|
43
|
-
|
44
|
-
# Read the master ID if we have it in the file.
|
45
|
-
env[:clone_id] = master_id_file.read.chomp if master_id_file.file?
|
46
|
-
|
47
|
-
# If we have the ID and the VM exists already, then we
|
48
|
-
# have nothing to do. Success!
|
49
|
-
if env[:clone_id] && env[:machine].provider.driver.vm_exists?(env[:clone_id])
|
50
|
-
@logger.info(
|
51
|
-
"Master VM for '#{env[:machine].box.name}' already exists " +
|
52
|
-
" (id=#{env[:clone_id]}) - skipping import step.")
|
53
|
-
return
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
1
|
+
require "log4r"
|
2
|
+
|
3
|
+
require "digest/md5"
|
4
|
+
|
5
|
+
module VagrantPlugins
|
6
|
+
module ProviderVirtualBox
|
7
|
+
module Action
|
8
|
+
class ImportMaster
|
9
|
+
def initialize(app, env)
|
10
|
+
@app = app
|
11
|
+
@logger = Log4r::Logger.new("vagrant::action::vm::create_master")
|
12
|
+
end
|
13
|
+
|
14
|
+
def call(env)
|
15
|
+
# If we don't have a box, nothing to do
|
16
|
+
if !env[:machine].box
|
17
|
+
return @app.call(env)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Do the import while locked so that nobody else imports
|
21
|
+
# a master at the same time. This is a no-op if we already
|
22
|
+
# have a master that exists.
|
23
|
+
lock_key = Digest::MD5.hexdigest(env[:machine].box.name)
|
24
|
+
env[:machine].env.lock(lock_key, retry: true) do
|
25
|
+
import_master(env)
|
26
|
+
end
|
27
|
+
|
28
|
+
# If we got interrupted, then the import could have been
|
29
|
+
# interrupted and its not a big deal. Just return out.
|
30
|
+
if env[:interrupted]
|
31
|
+
@logger.info("Import of master VM was interrupted -> exiting.")
|
32
|
+
return
|
33
|
+
end
|
34
|
+
|
35
|
+
# Import completed successfully. Continue the chain
|
36
|
+
@app.call(env)
|
37
|
+
end
|
38
|
+
|
39
|
+
protected
|
40
|
+
|
41
|
+
def import_master(env)
|
42
|
+
master_id_file = env[:machine].box.directory.join("master_id")
|
43
|
+
|
44
|
+
# Read the master ID if we have it in the file.
|
45
|
+
env[:clone_id] = master_id_file.read.chomp if master_id_file.file?
|
46
|
+
|
47
|
+
# If we have the ID and the VM exists already, then we
|
48
|
+
# have nothing to do. Success!
|
49
|
+
if env[:clone_id] && env[:machine].provider.driver.vm_exists?(env[:clone_id])
|
50
|
+
@logger.info(
|
51
|
+
"Master VM for '#{env[:machine].box.name}' already exists " +
|
52
|
+
" (id=#{env[:clone_id]}) - skipping import step.")
|
53
|
+
return
|
54
|
+
else
|
55
|
+
if env.delete(:clone_id)
|
56
|
+
@logger.info("Deleting previous reference for master VM" +
|
57
|
+
"'#{env[:machine].box.name}' (id=#{env[:clone_id]}) - " +
|
58
|
+
"maybe it was removed manually")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
env[:ui].info(I18n.t("vagrant.actions.vm.clone.setup_master"))
|
63
|
+
env[:ui].detail(I18n.t("vagrant.actions.vm.clone.setup_master_detail"))
|
64
|
+
|
65
|
+
# Import the virtual machine
|
66
|
+
import_env = env[:action_runner].run(Import, env.dup.merge(skip_machine: true))
|
67
|
+
env[:clone_id] = import_env[:machine_id]
|
68
|
+
|
69
|
+
@logger.info(
|
70
|
+
"Imported box #{env[:machine].box.name} as master vm " +
|
71
|
+
"with id #{env[:clone_id]}")
|
72
|
+
|
73
|
+
@logger.debug("Writing id of master VM '#{env[:clone_id]}' to #{master_id_file}")
|
74
|
+
master_id_file.open("w+") do |f|
|
75
|
+
f.write(env[:clone_id])
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'vagrant/action/general/package'
|
1
|
+
require_relative "../../../../lib/vagrant/action/general/package"
|
4
2
|
|
5
3
|
module VagrantPlugins
|
6
4
|
module ProviderVirtualBox
|
@@ -10,33 +8,7 @@ module VagrantPlugins
|
|
10
8
|
# called in the unit tests.
|
11
9
|
alias_method :general_call, :call
|
12
10
|
def call(env)
|
13
|
-
# Setup the temporary directory
|
14
|
-
@temp_dir = env[:tmp_path].join(Time.now.to_i.to_s)
|
15
|
-
env["export.temp_dir"] = @temp_dir
|
16
|
-
FileUtils.mkpath(env["export.temp_dir"])
|
17
|
-
|
18
|
-
# Just match up a couple environmental variables so that
|
19
|
-
# the superclass will do the right thing. Then, call the
|
20
|
-
# superclass
|
21
|
-
env["package.directory"] = env["export.temp_dir"]
|
22
|
-
|
23
11
|
general_call(env)
|
24
|
-
|
25
|
-
# Always call recover to clean up the temp dir
|
26
|
-
clean_temp_dir
|
27
|
-
end
|
28
|
-
|
29
|
-
def recover(env)
|
30
|
-
clean_temp_dir
|
31
|
-
super
|
32
|
-
end
|
33
|
-
|
34
|
-
protected
|
35
|
-
|
36
|
-
def clean_temp_dir
|
37
|
-
if @temp_dir && File.exist?(@temp_dir)
|
38
|
-
FileUtils.rm_rf(@temp_dir)
|
39
|
-
end
|
40
12
|
end
|
41
13
|
end
|
42
14
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module ProviderVirtualBox
|
3
|
+
module Action
|
4
|
+
class PackageSetupFiles
|
5
|
+
def initialize(app, env)
|
6
|
+
@app = app
|
7
|
+
|
8
|
+
env["package.include"] ||= []
|
9
|
+
env["package.vagrantfile"] ||= nil
|
10
|
+
end
|
11
|
+
|
12
|
+
def call(env)
|
13
|
+
files = {}
|
14
|
+
env["package.include"].each do |file|
|
15
|
+
source = Pathname.new(file)
|
16
|
+
dest = nil
|
17
|
+
|
18
|
+
# If the source is relative then we add the file as-is to the include
|
19
|
+
# directory. Otherwise, we copy only the file into the root of the
|
20
|
+
# include directory. Kind of strange, but seems to match what people
|
21
|
+
# expect based on history.
|
22
|
+
if source.relative?
|
23
|
+
dest = source
|
24
|
+
else
|
25
|
+
dest = source.basename
|
26
|
+
end
|
27
|
+
|
28
|
+
# Assign the mapping
|
29
|
+
files[file] = dest
|
30
|
+
end
|
31
|
+
|
32
|
+
if env["package.vagrantfile"]
|
33
|
+
# Vagrantfiles are treated special and mapped to a specific file
|
34
|
+
files[env["package.vagrantfile"]] = "_Vagrantfile"
|
35
|
+
end
|
36
|
+
|
37
|
+
# Verify the mapping
|
38
|
+
files.each do |from, _|
|
39
|
+
raise Vagrant::Errors::PackageIncludeMissing,
|
40
|
+
file: from if !File.exist?(from)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Save the mapping
|
44
|
+
env["package.files"] = files
|
45
|
+
|
46
|
+
@app.call(env)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require "fileutils"
|
2
|
+
|
3
|
+
require_relative "../../../../lib/vagrant/action/general/package"
|
4
|
+
|
5
|
+
module VagrantPlugins
|
6
|
+
module ProviderVirtualBox
|
7
|
+
module Action
|
8
|
+
class PackageSetupFolders
|
9
|
+
include Vagrant::Util::Presence
|
10
|
+
|
11
|
+
def initialize(app, env)
|
12
|
+
@app = app
|
13
|
+
end
|
14
|
+
|
15
|
+
def call(env)
|
16
|
+
env["package.output"] ||= "package.box"
|
17
|
+
env["package.directory"] ||= Dir.mktmpdir("vagrant-package-", env[:tmp_path])
|
18
|
+
|
19
|
+
# Match up a couple environmental variables so that the other parts of
|
20
|
+
# Vagrant will do the right thing.
|
21
|
+
env["export.temp_dir"] = env["package.directory"]
|
22
|
+
|
23
|
+
Vagrant::Action::General::Package.validate!(
|
24
|
+
env["package.output"], env["package.directory"])
|
25
|
+
|
26
|
+
@app.call(env)
|
27
|
+
end
|
28
|
+
|
29
|
+
def recover(env)
|
30
|
+
dir = env["package.directory"]
|
31
|
+
if File.exist?(dir)
|
32
|
+
FileUtils.rm_rf(dir)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -37,7 +37,27 @@ module VagrantPlugins
|
|
37
37
|
# The ! indicates that this method modifies its argument.
|
38
38
|
def add_ips_to_env!(env)
|
39
39
|
adapter, host_ip = find_host_only_adapter
|
40
|
-
machine_ip = read_static_machine_ips
|
40
|
+
machine_ip = read_static_machine_ips
|
41
|
+
|
42
|
+
if !machine_ip
|
43
|
+
# No static IP, attempt to use the dynamic IP.
|
44
|
+
machine_ip = read_dynamic_machine_ip(adapter)
|
45
|
+
else
|
46
|
+
# We have static IPs, also attempt to read any dynamic IPs.
|
47
|
+
# If there is no dynamic IP on the adapter, it doesn't matter. We
|
48
|
+
# already have a static IP.
|
49
|
+
begin
|
50
|
+
dynamic_ip = read_dynamic_machine_ip(adapter)
|
51
|
+
rescue Vagrant::Errors::NFSNoGuestIP
|
52
|
+
dynamic_ip = nil
|
53
|
+
end
|
54
|
+
|
55
|
+
# If we found a dynamic IP and we didn't include it in the
|
56
|
+
# machine_ip array yet, do so.
|
57
|
+
if dynamic_ip && !machine_ip.include?(dynamic_ip)
|
58
|
+
machine_ip.push(dynamic_ip)
|
59
|
+
end
|
60
|
+
end
|
41
61
|
|
42
62
|
raise Vagrant::Errors::NFSNoHostonlyNetwork if !host_ip || !machine_ip
|
43
63
|
|
@@ -70,6 +90,8 @@ module VagrantPlugins
|
|
70
90
|
def read_static_machine_ips
|
71
91
|
ips = []
|
72
92
|
@machine.config.vm.networks.each do |type, options|
|
93
|
+
options = scoped_hash_override(options, :virtualbox)
|
94
|
+
|
73
95
|
if type == :private_network && options[:type] != :dhcp && options[:ip].is_a?(String)
|
74
96
|
ips << options[:ip]
|
75
97
|
end
|
@@ -1,49 +1,15 @@
|
|
1
|
+
require "log4r"
|
2
|
+
|
3
|
+
require_relative "package_setup_files"
|
4
|
+
|
1
5
|
module VagrantPlugins
|
2
6
|
module ProviderVirtualBox
|
3
7
|
module Action
|
4
|
-
class SetupPackageFiles
|
5
|
-
def initialize(
|
6
|
-
@
|
7
|
-
|
8
|
-
|
9
|
-
env["package.vagrantfile"] ||= nil
|
10
|
-
end
|
11
|
-
|
12
|
-
def call(env)
|
13
|
-
files = {}
|
14
|
-
env["package.include"].each do |file|
|
15
|
-
source = Pathname.new(file)
|
16
|
-
dest = nil
|
17
|
-
|
18
|
-
# If the source is relative then we add the file as-is to the include
|
19
|
-
# directory. Otherwise, we copy only the file into the root of the
|
20
|
-
# include directory. Kind of strange, but seems to match what people
|
21
|
-
# expect based on history.
|
22
|
-
if source.relative?
|
23
|
-
dest = source
|
24
|
-
else
|
25
|
-
dest = source.basename
|
26
|
-
end
|
27
|
-
|
28
|
-
# Assign the mapping
|
29
|
-
files[file] = dest
|
30
|
-
end
|
31
|
-
|
32
|
-
if env["package.vagrantfile"]
|
33
|
-
# Vagrantfiles are treated special and mapped to a specific file
|
34
|
-
files[env["package.vagrantfile"]] = "_Vagrantfile"
|
35
|
-
end
|
36
|
-
|
37
|
-
# Verify the mapping
|
38
|
-
files.each do |from, _|
|
39
|
-
raise Vagrant::Errors::PackageIncludeMissing,
|
40
|
-
file: from if !File.exist?(from)
|
41
|
-
end
|
42
|
-
|
43
|
-
# Save the mapping
|
44
|
-
env["package.files"] = files
|
45
|
-
|
46
|
-
@app.call(env)
|
8
|
+
class SetupPackageFiles < PackageSetupFiles
|
9
|
+
def initialize(*)
|
10
|
+
@logger = Log4r::Logger.new("vagrant::plugins::virtualbox::setup_package_files")
|
11
|
+
@logger.warn { "SetupPackageFiles has been renamed to PackageSetupFiles" }
|
12
|
+
super
|
47
13
|
end
|
48
14
|
end
|
49
15
|
end
|
@@ -34,6 +34,17 @@ module VagrantPlugins
|
|
34
34
|
end
|
35
35
|
end
|
36
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
|
+
|
37
48
|
def create_dhcp_server(network, options)
|
38
49
|
execute("dhcpserver", "add", "--ifname", network,
|
39
50
|
"--ip", options[:dhcp_ip],
|
@@ -71,6 +82,86 @@ module VagrantPlugins
|
|
71
82
|
}
|
72
83
|
end
|
73
84
|
|
85
|
+
def create_snapshot(machine_id, snapshot_name)
|
86
|
+
execute("snapshot", machine_id, "take", snapshot_name)
|
87
|
+
end
|
88
|
+
|
89
|
+
def delete_snapshot(machine_id, snapshot_name)
|
90
|
+
# Start with 0%
|
91
|
+
last = 0
|
92
|
+
total = ""
|
93
|
+
yield 0 if block_given?
|
94
|
+
|
95
|
+
# Snapshot and report the % progress
|
96
|
+
execute("snapshot", machine_id, "delete", snapshot_name) do |type, data|
|
97
|
+
if type == :stderr
|
98
|
+
# Append the data so we can see the full view
|
99
|
+
total << data.gsub("\r", "")
|
100
|
+
|
101
|
+
# Break up the lines. We can't get the progress until we see an "OK"
|
102
|
+
lines = total.split("\n")
|
103
|
+
|
104
|
+
# The progress of the import will be in the last line. Do a greedy
|
105
|
+
# regular expression to find what we're looking for.
|
106
|
+
match = /.+(\d{2})%/.match(lines.last)
|
107
|
+
if match
|
108
|
+
current = match[1].to_i
|
109
|
+
if current > last
|
110
|
+
last = current
|
111
|
+
yield current if block_given?
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def list_snapshots(machine_id)
|
119
|
+
output = execute(
|
120
|
+
"snapshot", machine_id, "list", "--machinereadable",
|
121
|
+
retryable: true)
|
122
|
+
|
123
|
+
result = []
|
124
|
+
output.split("\n").each do |line|
|
125
|
+
if line =~ /^SnapshotName.*?="(.+?)"$/i
|
126
|
+
result << $1.to_s
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
result.sort
|
131
|
+
rescue Vagrant::Errors::VBoxManageError => e
|
132
|
+
d = e.extra_data
|
133
|
+
return [] if d[:stderr].include?("does not have") || d[:stdout].include?("does not have")
|
134
|
+
raise
|
135
|
+
end
|
136
|
+
|
137
|
+
def restore_snapshot(machine_id, snapshot_name)
|
138
|
+
# Start with 0%
|
139
|
+
last = 0
|
140
|
+
total = ""
|
141
|
+
yield 0 if block_given?
|
142
|
+
|
143
|
+
execute("snapshot", machine_id, "restore", snapshot_name) do |type, data|
|
144
|
+
if type == :stderr
|
145
|
+
# Append the data so we can see the full view
|
146
|
+
total << data.gsub("\r", "")
|
147
|
+
|
148
|
+
# Break up the lines. We can't get the progress until we see an "OK"
|
149
|
+
lines = total.split("\n")
|
150
|
+
|
151
|
+
# The progress of the import will be in the last line. Do a greedy
|
152
|
+
# regular expression to find what we're looking for.
|
153
|
+
match = /.+(\d{2})%/.match(lines.last)
|
154
|
+
if match
|
155
|
+
current = match[1].to_i
|
156
|
+
if current > last
|
157
|
+
last = current
|
158
|
+
yield current if block_given?
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
74
165
|
def delete
|
75
166
|
execute("unregistervm", @uuid, "--delete")
|
76
167
|
end
|
@@ -167,6 +258,13 @@ module VagrantPlugins
|
|
167
258
|
execute("modifyvm", @uuid, *args) if !args.empty?
|
168
259
|
end
|
169
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
|
+
|
170
268
|
def halt
|
171
269
|
execute("controlvm", @uuid, "poweroff")
|
172
270
|
end
|
@@ -524,9 +622,9 @@ module VagrantPlugins
|
|
524
622
|
"--name", name,
|
525
623
|
"--transient")
|
526
624
|
|
527
|
-
|
528
|
-
|
529
|
-
|
625
|
+
execute(
|
626
|
+
"setextradata", @uuid,
|
627
|
+
"VBoxInternal2/SharedFoldersEnableSymlinksCreate/#{name}")
|
530
628
|
rescue Vagrant::Errors::VBoxManageError => e
|
531
629
|
if e.extra_data[:stderr].include?("VBOX_E_FILE_ERROR")
|
532
630
|
# The folder doesn't exist. ignore.
|
@@ -563,9 +661,9 @@ module VagrantPlugins
|
|
563
661
|
result = raw("showvminfo", uuid)
|
564
662
|
return true if result.exit_code == 0
|
565
663
|
|
566
|
-
#
|
567
|
-
#
|
568
|
-
return false if
|
664
|
+
# If vboxmanage returned VBOX_E_OBJECT_NOT_FOUND,
|
665
|
+
# then the vm truly does not exist. Any other error might be transient
|
666
|
+
return false if result.stderr.include?("VBOX_E_OBJECT_NOT_FOUND")
|
569
667
|
|
570
668
|
# Sleep a bit though to give VirtualBox time to fix itself
|
571
669
|
sleep 2
|