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
@@ -34,28 +34,18 @@ module VagrantPlugins
|
|
34
34
|
def validate(machine)
|
35
35
|
super
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
if error_message_key
|
46
|
-
@errors << I18n.t(error_message_key, path: expanded_path, system: "host")
|
37
|
+
if raw_ssh_args
|
38
|
+
if raw_ssh_args.kind_of?(String)
|
39
|
+
@raw_ssh_args = [raw_ssh_args]
|
40
|
+
elsif !raw_ssh_args.kind_of?(Array)
|
41
|
+
@errors << I18n.t(
|
42
|
+
"vagrant.provisioners.ansible.errors.raw_ssh_args_invalid",
|
43
|
+
type: raw_ssh_args.class.to_s,
|
44
|
+
value: raw_ssh_args.to_s)
|
47
45
|
end
|
48
|
-
return false
|
49
46
|
end
|
50
|
-
true
|
51
|
-
end
|
52
|
-
|
53
|
-
def check_path_is_a_file(machine, path, error_message_key = nil)
|
54
|
-
check_path(machine, path, "file?", error_message_key)
|
55
|
-
end
|
56
47
|
|
57
|
-
|
58
|
-
check_path(machine, path, "exist?", error_message_key)
|
48
|
+
{ "ansible remote provisioner" => @errors }
|
59
49
|
end
|
60
50
|
|
61
51
|
end
|
@@ -19,6 +19,10 @@ module VagrantPlugins
|
|
19
19
|
error_key(:ansible_not_found_on_guest)
|
20
20
|
end
|
21
21
|
|
22
|
+
class AnsiblePipInstallIsNotSupported < AnsibleError
|
23
|
+
error_key(:cannot_support_pip_install)
|
24
|
+
end
|
25
|
+
|
22
26
|
class AnsibleVersionNotFoundOnGuest < AnsibleError
|
23
27
|
error_key(:ansible_version_not_found_on_guest)
|
24
28
|
end
|
@@ -3,35 +3,15 @@ require "vagrant"
|
|
3
3
|
module VagrantPlugins
|
4
4
|
module Ansible
|
5
5
|
class Helpers
|
6
|
-
def self.
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
shell_command += "#{k}='#{v}' "
|
11
|
-
else
|
12
|
-
shell_command += "#{k}=#{v} "
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
shell_arg = []
|
17
|
-
command.each do |arg|
|
18
|
-
if arg =~ /(--start-at-task|--limit)=(.+)/
|
19
|
-
shell_arg << "#{$1}='#{$2}'"
|
20
|
-
else
|
21
|
-
shell_arg << arg
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
shell_command += shell_arg.join(' ')
|
6
|
+
def self.expand_path_in_unix_style(path, base_dir)
|
7
|
+
# Remove the possible drive letter, which is added
|
8
|
+
# by `File.expand_path` when running on a Windows host
|
9
|
+
File.expand_path(path, base_dir).sub(/^[a-zA-Z]:/, "")
|
26
10
|
end
|
27
11
|
|
28
12
|
def self.as_list_argument(v)
|
29
13
|
v.kind_of?(Array) ? v.join(',') : v
|
30
14
|
end
|
31
|
-
|
32
|
-
def self.as_array(v)
|
33
|
-
v.kind_of?(Array) ? v : [v]
|
34
|
-
end
|
35
15
|
end
|
36
16
|
end
|
37
17
|
end
|
@@ -25,6 +25,48 @@ module VagrantPlugins
|
|
25
25
|
@inventory_path = nil
|
26
26
|
end
|
27
27
|
|
28
|
+
def check_files_existence
|
29
|
+
check_path_is_a_file config.playbook, :playbook
|
30
|
+
|
31
|
+
check_path_exists config.inventory_path, :inventory_path if config.inventory_path
|
32
|
+
check_path_is_a_file config.extra_vars[1..-1], :extra_vars if has_an_extra_vars_file_argument
|
33
|
+
check_path_is_a_file config.galaxy_role_file, :galaxy_role_file if config.galaxy_role_file
|
34
|
+
check_path_is_a_file config.vault_password_file, :vault_password if config.vault_password_file
|
35
|
+
end
|
36
|
+
|
37
|
+
def ansible_playbook_command_for_shell_execution
|
38
|
+
shell_command = []
|
39
|
+
@environment_variables.each_pair do |k, v|
|
40
|
+
if k =~ /ANSIBLE_SSH_ARGS|ANSIBLE_ROLES_PATH/
|
41
|
+
shell_command << "#{k}='#{v}'"
|
42
|
+
else
|
43
|
+
shell_command << "#{k}=#{v}"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
shell_command << "ansible-playbook"
|
48
|
+
|
49
|
+
shell_args = []
|
50
|
+
@command_arguments.each do |arg|
|
51
|
+
if arg =~ /(--start-at-task|--limit)=(.+)/
|
52
|
+
shell_args << %Q(#{$1}="#{$2}")
|
53
|
+
elsif arg =~ /(--extra-vars)=(.+)/
|
54
|
+
shell_args << %Q(%s="%s") % [$1, $2.gsub('\\', '\\\\\\').gsub('"', %Q(\\"))]
|
55
|
+
else
|
56
|
+
shell_args << arg
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
shell_command << shell_args
|
61
|
+
|
62
|
+
# Add the raw arguments at the end, to give them the highest precedence
|
63
|
+
shell_command << config.raw_arguments if config.raw_arguments
|
64
|
+
|
65
|
+
shell_command << config.playbook
|
66
|
+
|
67
|
+
shell_command.flatten.join(' ')
|
68
|
+
end
|
69
|
+
|
28
70
|
def prepare_common_command_arguments
|
29
71
|
# By default we limit by the current machine,
|
30
72
|
# but this can be overridden by the `limit` option.
|
@@ -43,10 +85,6 @@ module VagrantPlugins
|
|
43
85
|
@command_arguments << "--tags=#{Helpers::as_list_argument(config.tags)}" if config.tags
|
44
86
|
@command_arguments << "--skip-tags=#{Helpers::as_list_argument(config.skip_tags)}" if config.skip_tags
|
45
87
|
@command_arguments << "--start-at-task=#{config.start_at_task}" if config.start_at_task
|
46
|
-
|
47
|
-
# Finally, add the raw configuration options, which has the highest precedence
|
48
|
-
# and can therefore potentially override any other options of this provisioner.
|
49
|
-
@command_arguments.concat(Helpers::as_array(config.raw_arguments)) if config.raw_arguments
|
50
88
|
end
|
51
89
|
|
52
90
|
def prepare_common_environment_variables
|
@@ -60,6 +98,10 @@ module VagrantPlugins
|
|
60
98
|
# Setting ANSIBLE_NOCOLOR is "unnecessary" at the moment, but this could change in the future
|
61
99
|
# (e.g. local provisioner [GH-2103], possible change in vagrant/ansible integration, etc.)
|
62
100
|
@environment_variables["ANSIBLE_NOCOLOR"] = "true" if !@machine.env.ui.color?
|
101
|
+
|
102
|
+
# Use ANSIBLE_ROLES_PATH to tell ansible-playbook where to look for roles
|
103
|
+
# (there is no equivalent command line argument in ansible-playbook)
|
104
|
+
@environment_variables["ANSIBLE_ROLES_PATH"] = get_galaxy_roles_path if config.galaxy_roles_path
|
63
105
|
end
|
64
106
|
|
65
107
|
# Auto-generate "safe" inventory file based on Vagrantfile,
|
@@ -169,8 +211,12 @@ module VagrantPlugins
|
|
169
211
|
return inventory_groups
|
170
212
|
end
|
171
213
|
|
214
|
+
def has_an_extra_vars_file_argument
|
215
|
+
config.extra_vars && config.extra_vars.kind_of?(String) && config.extra_vars =~ /^@.+$/
|
216
|
+
end
|
217
|
+
|
172
218
|
def extra_vars_argument
|
173
|
-
if
|
219
|
+
if has_an_extra_vars_file_argument
|
174
220
|
# A JSON or YAML file is referenced.
|
175
221
|
config.extra_vars
|
176
222
|
else
|
@@ -179,15 +225,17 @@ module VagrantPlugins
|
|
179
225
|
end
|
180
226
|
end
|
181
227
|
|
182
|
-
def get_galaxy_role_file
|
183
|
-
|
228
|
+
def get_galaxy_role_file
|
229
|
+
Helpers::expand_path_in_unix_style(config.galaxy_role_file, get_provisioning_working_directory)
|
184
230
|
end
|
185
231
|
|
186
|
-
def get_galaxy_roles_path
|
232
|
+
def get_galaxy_roles_path
|
233
|
+
base_dir = get_provisioning_working_directory
|
187
234
|
if config.galaxy_roles_path
|
188
|
-
|
235
|
+
Helpers::expand_path_in_unix_style(config.galaxy_roles_path, base_dir)
|
189
236
|
else
|
190
|
-
|
237
|
+
playbook_path = Helpers::expand_path_in_unix_style(config.playbook, base_dir)
|
238
|
+
File.join(Pathname.new(playbook_path).parent, 'roles')
|
191
239
|
end
|
192
240
|
end
|
193
241
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "tempfile"
|
2
2
|
|
3
3
|
require_relative "base"
|
4
4
|
|
@@ -6,6 +6,7 @@ module VagrantPlugins
|
|
6
6
|
module Ansible
|
7
7
|
module Provisioner
|
8
8
|
class Guest < Base
|
9
|
+
include Vagrant::Util
|
9
10
|
|
10
11
|
def initialize(machine, config)
|
11
12
|
super
|
@@ -13,6 +14,7 @@ module VagrantPlugins
|
|
13
14
|
end
|
14
15
|
|
15
16
|
def provision
|
17
|
+
check_files_existence
|
16
18
|
check_and_install_ansible
|
17
19
|
execute_ansible_galaxy_on_guest if config.galaxy_role_file
|
18
20
|
execute_ansible_playbook_on_guest
|
@@ -47,14 +49,15 @@ module VagrantPlugins
|
|
47
49
|
(config.version.to_s.to_sym == :latest ||
|
48
50
|
!@machine.guest.capability(:ansible_installed, config.version))
|
49
51
|
@machine.ui.detail I18n.t("vagrant.provisioners.ansible.installing")
|
50
|
-
@machine.guest.capability(:ansible_install)
|
52
|
+
@machine.guest.capability(:ansible_install, config.install_mode, config.version)
|
51
53
|
end
|
52
54
|
|
53
55
|
# Check that ansible binaries are well installed on the guest,
|
54
56
|
@machine.communicate.execute(
|
55
|
-
"ansible-galaxy --help && ansible-playbook --help",
|
56
|
-
:
|
57
|
-
:
|
57
|
+
"ansible-galaxy info --help && ansible-playbook --help",
|
58
|
+
error_class: Ansible::Errors::AnsibleNotFoundOnGuest,
|
59
|
+
error_key: :ansible_not_found_on_guest
|
60
|
+
)
|
58
61
|
|
59
62
|
# Check if requested ansible version is available
|
60
63
|
if (!config.version.empty? &&
|
@@ -64,11 +67,16 @@ module VagrantPlugins
|
|
64
67
|
end
|
65
68
|
end
|
66
69
|
|
70
|
+
def get_provisioning_working_directory
|
71
|
+
config.provisioning_path
|
72
|
+
end
|
73
|
+
|
67
74
|
def execute_ansible_galaxy_on_guest
|
68
75
|
command_values = {
|
69
|
-
:
|
70
|
-
:
|
76
|
+
role_file: "'#{get_galaxy_role_file}'",
|
77
|
+
roles_path: "'#{get_galaxy_roles_path}'"
|
71
78
|
}
|
79
|
+
|
72
80
|
remote_command = config.galaxy_command % command_values
|
73
81
|
|
74
82
|
execute_ansible_command_on_guest "galaxy", remote_command
|
@@ -78,23 +86,22 @@ module VagrantPlugins
|
|
78
86
|
prepare_common_command_arguments
|
79
87
|
prepare_common_environment_variables
|
80
88
|
|
81
|
-
|
82
|
-
remote_command = "cd #{config.provisioning_path} && #{Helpers::stringify_ansible_playbook_command(@environment_variables, command)}"
|
83
|
-
|
84
|
-
execute_ansible_command_on_guest "playbook", remote_command
|
89
|
+
execute_ansible_command_on_guest "playbook", ansible_playbook_command_for_shell_execution
|
85
90
|
end
|
86
91
|
|
87
92
|
def execute_ansible_command_on_guest(name, command)
|
88
|
-
|
93
|
+
remote_command = "cd #{config.provisioning_path} && #{command}"
|
89
94
|
|
90
|
-
|
95
|
+
ui_running_ansible_command name, remote_command
|
96
|
+
|
97
|
+
result = execute_on_guest(remote_command)
|
91
98
|
raise Ansible::Errors::AnsibleCommandFailed if result != 0
|
92
99
|
end
|
93
100
|
|
94
101
|
def execute_on_guest(command)
|
95
|
-
@machine.communicate.execute(command, :
|
102
|
+
@machine.communicate.execute(command, error_check: false) do |type, data|
|
96
103
|
if [:stderr, :stdout].include?(type)
|
97
|
-
@machine.env.ui.info(data, :
|
104
|
+
@machine.env.ui.info(data, new_line: false, prefix: false)
|
98
105
|
end
|
99
106
|
end
|
100
107
|
end
|
@@ -103,14 +110,15 @@ module VagrantPlugins
|
|
103
110
|
inventory_basedir = File.join(config.tmp_path, "inventory")
|
104
111
|
inventory_path = File.join(inventory_basedir, "vagrant_ansible_local_inventory")
|
105
112
|
|
106
|
-
temp_inventory = Tempfile.new("vagrant_ansible_local_inventory_#{@machine.name}")
|
107
|
-
temp_inventory.write(inventory_content)
|
108
|
-
temp_inventory.close
|
109
|
-
|
110
113
|
create_and_chown_remote_folder(inventory_basedir)
|
111
|
-
@machine.communicate.
|
112
|
-
|
113
|
-
|
114
|
+
@machine.communicate.sudo("rm -f #{inventory_path}", error_check: false)
|
115
|
+
|
116
|
+
Tempfile.open("vagrant-ansible-local-inventory-#{@machine.name}") do |f|
|
117
|
+
f.binmode
|
118
|
+
f.write(inventory_content)
|
119
|
+
f.fsync
|
120
|
+
f.close
|
121
|
+
@machine.communicate.upload(f.path, inventory_path)
|
114
122
|
end
|
115
123
|
|
116
124
|
return inventory_basedir
|
@@ -143,6 +151,31 @@ module VagrantPlugins
|
|
143
151
|
end
|
144
152
|
end
|
145
153
|
|
154
|
+
def check_path(path, test_args, option_name)
|
155
|
+
# Checks for the existence of given file (or directory) on the guest system,
|
156
|
+
# and error if it doesn't exist.
|
157
|
+
|
158
|
+
remote_path = Helpers::expand_path_in_unix_style(path, config.provisioning_path)
|
159
|
+
command = "test #{test_args} #{remote_path}"
|
160
|
+
|
161
|
+
@machine.communicate.execute(
|
162
|
+
command,
|
163
|
+
error_class: Ansible::Errors::AnsibleError,
|
164
|
+
error_key: :config_file_not_found,
|
165
|
+
config_option: option_name,
|
166
|
+
path: remote_path,
|
167
|
+
system: "guest"
|
168
|
+
)
|
169
|
+
end
|
170
|
+
|
171
|
+
def check_path_is_a_file(path, error_message_key)
|
172
|
+
check_path(path, "-f", error_message_key)
|
173
|
+
end
|
174
|
+
|
175
|
+
def check_path_exists(path, error_message_key)
|
176
|
+
check_path(path, "-e", error_message_key)
|
177
|
+
end
|
178
|
+
|
146
179
|
end
|
147
180
|
end
|
148
181
|
end
|
@@ -18,6 +18,7 @@ module VagrantPlugins
|
|
18
18
|
# At this stage, the SSH access is guaranteed to be ready
|
19
19
|
@ssh_info = @machine.ssh_info
|
20
20
|
|
21
|
+
check_files_existence
|
21
22
|
warn_for_unsupported_platform
|
22
23
|
execute_ansible_galaxy_from_host if config.galaxy_role_file
|
23
24
|
execute_ansible_playbook_from_host
|
@@ -88,14 +89,12 @@ module VagrantPlugins
|
|
88
89
|
|
89
90
|
def execute_ansible_galaxy_from_host
|
90
91
|
command_values = {
|
91
|
-
:
|
92
|
-
:
|
92
|
+
role_file: get_galaxy_role_file,
|
93
|
+
roles_path: get_galaxy_roles_path
|
93
94
|
}
|
94
95
|
command_template = config.galaxy_command.gsub(' ', VAGRANT_ARG_SEPARATOR)
|
95
96
|
str_command = command_template % command_values
|
96
97
|
|
97
|
-
ui_running_ansible_command "galaxy", str_command.gsub(VAGRANT_ARG_SEPARATOR, ' ')
|
98
|
-
|
99
98
|
command = str_command.split(VAGRANT_ARG_SEPARATOR)
|
100
99
|
command << {
|
101
100
|
# Write stdout and stderr data, since it's the regular Ansible output
|
@@ -103,6 +102,9 @@ module VagrantPlugins
|
|
103
102
|
workdir: @machine.env.root_path.to_s
|
104
103
|
}
|
105
104
|
|
105
|
+
# FIXME: role_file and roles_path arguments should be quoted in the console output
|
106
|
+
ui_running_ansible_command "galaxy", str_command.gsub(VAGRANT_ARG_SEPARATOR, ' ')
|
107
|
+
|
106
108
|
execute_command_from_host command
|
107
109
|
end
|
108
110
|
|
@@ -111,9 +113,13 @@ module VagrantPlugins
|
|
111
113
|
prepare_environment_variables
|
112
114
|
|
113
115
|
# Assemble the full ansible-playbook command
|
114
|
-
command =
|
116
|
+
command = %w(ansible-playbook) << @command_arguments
|
115
117
|
|
116
|
-
|
118
|
+
# Add the raw arguments at the end, to give them the highest precedence
|
119
|
+
command << config.raw_arguments if config.raw_arguments
|
120
|
+
|
121
|
+
command << config.playbook
|
122
|
+
command = command.flatten
|
117
123
|
|
118
124
|
command << {
|
119
125
|
env: @environment_variables,
|
@@ -122,6 +128,8 @@ module VagrantPlugins
|
|
122
128
|
workdir: @machine.env.root_path.to_s
|
123
129
|
}
|
124
130
|
|
131
|
+
ui_running_ansible_command "playbook", ansible_playbook_command_for_shell_execution
|
132
|
+
|
125
133
|
execute_command_from_host command
|
126
134
|
end
|
127
135
|
|
@@ -132,8 +140,15 @@ module VagrantPlugins
|
|
132
140
|
inventory_file = Pathname.new(File.join(inventory_path, 'vagrant_ansible_inventory'))
|
133
141
|
@@lock.synchronize do
|
134
142
|
if !File.exists?(inventory_file) or inventory_content != File.read(inventory_file)
|
135
|
-
|
136
|
-
|
143
|
+
begin
|
144
|
+
# ansible dir inventory will ignore files starting with '.'
|
145
|
+
inventory_tmpfile = Tempfile.new('.vagrant_ansible_inventory', inventory_path)
|
146
|
+
inventory_tmpfile.write(inventory_content)
|
147
|
+
inventory_tmpfile.close
|
148
|
+
File.rename(inventory_tmpfile.path, inventory_file)
|
149
|
+
ensure
|
150
|
+
inventory_tmpfile.close
|
151
|
+
inventory_tmpfile.unlink
|
137
152
|
end
|
138
153
|
end
|
139
154
|
end
|
@@ -174,6 +189,10 @@ module VagrantPlugins
|
|
174
189
|
return machines
|
175
190
|
end
|
176
191
|
|
192
|
+
def get_provisioning_working_directory
|
193
|
+
machine.env.root_path
|
194
|
+
end
|
195
|
+
|
177
196
|
def get_inventory_ssh_machine(machine, ssh_info)
|
178
197
|
forced_remote_user = ""
|
179
198
|
if config.force_remote_user
|
@@ -237,7 +256,7 @@ module VagrantPlugins
|
|
237
256
|
ssh_options << "-o ForwardAgent=yes" if @ssh_info[:forward_agent]
|
238
257
|
|
239
258
|
# Unchecked SSH Parameters
|
240
|
-
ssh_options.concat(
|
259
|
+
ssh_options.concat(config.raw_ssh_args) if config.raw_ssh_args
|
241
260
|
|
242
261
|
# Re-enable ControlPersist Ansible defaults,
|
243
262
|
# which are lost when ANSIBLE_SSH_ARGS is defined.
|
@@ -251,6 +270,28 @@ module VagrantPlugins
|
|
251
270
|
ssh_options.join(' ')
|
252
271
|
end
|
253
272
|
|
273
|
+
def check_path(path, path_test_method, option_name)
|
274
|
+
# Checks for the existence of given file (or directory) on the host system,
|
275
|
+
# and error if it doesn't exist.
|
276
|
+
|
277
|
+
expanded_path = Pathname.new(path).expand_path(@machine.env.root_path)
|
278
|
+
if !expanded_path.public_send(path_test_method)
|
279
|
+
raise Ansible::Errors::AnsibleError,
|
280
|
+
_key: :config_file_not_found,
|
281
|
+
config_option: option_name,
|
282
|
+
path: expanded_path,
|
283
|
+
system: "host"
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
def check_path_is_a_file(path, option_name)
|
288
|
+
check_path(path, "file?", option_name)
|
289
|
+
end
|
290
|
+
|
291
|
+
def check_path_exists(path, option_name)
|
292
|
+
check_path(path, "exist?", option_name)
|
293
|
+
end
|
294
|
+
|
254
295
|
end
|
255
296
|
end
|
256
297
|
end
|