vagrant-unbundled 2.2.6.1 → 2.2.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.hashibot.hcl +14 -0
- data/CHANGELOG.md +153 -2
- data/README.md +5 -7
- data/bin/vagrant +23 -0
- data/contrib/README.md +1 -0
- data/contrib/bash/completion.sh +13 -1
- data/contrib/sudoers/linux-suse +2 -2
- data/contrib/zsh/_vagrant +736 -0
- data/contrib/zsh/generate_zsh_completion.rb +166 -0
- data/lib/vagrant.rb +25 -0
- data/lib/vagrant/action.rb +8 -0
- data/lib/vagrant/action/builder.rb +193 -38
- data/lib/vagrant/action/builtin/box_add.rb +15 -7
- data/lib/vagrant/action/builtin/box_check_outdated.rb +12 -15
- data/lib/vagrant/action/builtin/cleanup_disks.rb +56 -0
- data/lib/vagrant/action/builtin/cloud_init_setup.rb +127 -0
- data/lib/vagrant/action/builtin/cloud_init_wait.rb +30 -0
- data/lib/vagrant/action/builtin/delayed.rb +26 -0
- data/lib/vagrant/action/builtin/disk.rb +52 -0
- data/lib/vagrant/action/builtin/handle_box.rb +3 -1
- data/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb +28 -9
- data/lib/vagrant/action/builtin/has_provisioner.rb +36 -0
- data/lib/vagrant/action/builtin/mixin_provisioners.rb +20 -1
- data/lib/vagrant/action/builtin/mixin_synced_folders.rb +20 -21
- data/lib/vagrant/action/builtin/set_hostname.rb +5 -1
- data/lib/vagrant/action/builtin/ssh_run.rb +21 -3
- data/lib/vagrant/action/builtin/synced_folders.rb +10 -0
- data/lib/vagrant/action/builtin/trigger.rb +37 -0
- data/lib/vagrant/action/hook.rb +76 -23
- data/lib/vagrant/action/runner.rb +11 -26
- data/lib/vagrant/action/warden.rb +28 -22
- data/lib/vagrant/box.rb +5 -4
- data/lib/vagrant/box_metadata.rb +17 -3
- data/lib/vagrant/bundler.rb +265 -53
- data/lib/vagrant/cli.rb +4 -2
- data/lib/vagrant/errors.rb +61 -1
- data/lib/vagrant/machine.rb +56 -6
- data/lib/vagrant/machine_index.rb +27 -1
- data/lib/vagrant/plugin/manager.rb +25 -14
- data/lib/vagrant/plugin/v2/command.rb +6 -2
- data/lib/vagrant/plugin/v2/components.rb +6 -0
- data/lib/vagrant/plugin/v2/manager.rb +67 -0
- data/lib/vagrant/plugin/v2/plugin.rb +13 -0
- data/lib/vagrant/plugin/v2/synced_folder.rb +50 -0
- data/lib/vagrant/plugin/v2/trigger.rb +64 -25
- data/lib/vagrant/shared_helpers.rb +28 -0
- data/lib/vagrant/ui.rb +51 -5
- data/lib/vagrant/util.rb +1 -0
- data/lib/vagrant/util/ansi_escape_code_remover.rb +1 -1
- data/lib/vagrant/util/caps.rb +48 -0
- data/lib/vagrant/util/credential_scrubber.rb +1 -1
- data/lib/vagrant/util/curl_helper.rb +8 -5
- data/lib/vagrant/util/directory.rb +19 -0
- data/lib/vagrant/util/downloader.rb +7 -3
- data/lib/vagrant/util/file_checksum.rb +6 -2
- data/lib/vagrant/util/guest_hosts.rb +68 -0
- data/lib/vagrant/util/guest_inspection.rb +9 -1
- data/lib/vagrant/util/install_cli_autocomplete.rb +118 -0
- data/lib/vagrant/util/io.rb +7 -27
- data/lib/vagrant/util/ipv4_interfaces.rb +15 -0
- data/lib/vagrant/util/is_port_open.rb +8 -20
- data/lib/vagrant/util/map_command_options.rb +33 -0
- data/lib/vagrant/util/network_ip.rb +11 -1
- data/lib/vagrant/util/numeric.rb +69 -0
- data/lib/vagrant/util/platform.rb +8 -1
- data/lib/vagrant/util/powershell.rb +1 -1
- data/lib/vagrant/util/subprocess.rb +9 -1
- data/lib/vagrant/vagrantfile.rb +1 -1
- data/plugins/commands/autocomplete/command/install.rb +49 -0
- data/plugins/commands/autocomplete/command/root.rb +64 -0
- data/plugins/commands/autocomplete/plugin.rb +18 -0
- data/plugins/commands/box/command/outdated.rb +14 -2
- data/plugins/commands/cloud/locales/en.yml +1 -1
- data/plugins/commands/cloud/publish.rb +1 -1
- data/plugins/commands/destroy/command.rb +6 -2
- data/plugins/commands/snapshot/command/save.rb +13 -8
- data/plugins/commands/ssh_config/command.rb +1 -1
- data/plugins/communicators/ssh/communicator.rb +25 -24
- data/plugins/communicators/winrm/config.rb +1 -1
- data/plugins/communicators/winrm/helper.rb +1 -1
- data/plugins/communicators/winrm/shell.rb +1 -1
- data/plugins/communicators/winssh/communicator.rb +126 -38
- data/plugins/communicators/winssh/config.rb +3 -7
- data/plugins/guests/alpine/cap/change_host_name.rb +10 -11
- data/plugins/guests/alpine/cap/rsync.rb +1 -1
- data/plugins/guests/alpine/plugin.rb +16 -0
- data/plugins/guests/alt/cap/change_host_name.rb +40 -53
- data/plugins/guests/arch/cap/change_host_name.rb +5 -14
- data/plugins/guests/arch/cap/configure_networks.rb +27 -10
- data/plugins/guests/atomic/cap/change_host_name.rb +5 -14
- data/plugins/guests/centos/cap/flavor.rb +24 -0
- data/plugins/guests/centos/guest.rb +9 -0
- data/plugins/guests/centos/plugin.rb +20 -0
- data/plugins/guests/darwin/cap/change_host_name.rb +10 -6
- data/plugins/guests/darwin/cap/mount_vmware_shared_folder.rb +99 -13
- data/plugins/guests/darwin/plugin.rb +5 -0
- data/plugins/guests/debian/cap/change_host_name.rb +11 -11
- data/plugins/guests/debian/cap/configure_networks.rb +14 -6
- data/plugins/guests/esxi/cap/public_key.rb +3 -1
- data/plugins/guests/freebsd/cap/change_host_name.rb +10 -6
- data/plugins/guests/gentoo/cap/change_host_name.rb +14 -22
- data/plugins/guests/haiku/cap/rsync.rb +19 -0
- data/plugins/guests/haiku/plugin.rb +15 -0
- data/plugins/guests/linux/cap/change_host_name.rb +46 -0
- data/plugins/guests/linux/cap/halt.rb +9 -1
- data/plugins/guests/linux/cap/mount_smb_shared_folder.rb +16 -0
- data/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb +4 -11
- data/plugins/guests/linux/cap/persist_mount_shared_folder.rb +62 -0
- data/plugins/guests/linux/cap/reboot.rb +48 -0
- data/plugins/guests/linux/plugin.rb +20 -0
- data/plugins/guests/omnios/cap/change_host_name.rb +10 -16
- data/plugins/guests/openbsd/cap/change_host_name.rb +10 -6
- data/plugins/guests/photon/cap/change_host_name.rb +9 -15
- data/plugins/guests/pld/cap/change_host_name.rb +11 -17
- data/plugins/guests/redhat/cap/change_host_name.rb +10 -5
- data/plugins/guests/redhat/cap/flavor.rb +3 -1
- data/plugins/guests/redhat/cap/nfs_client.rb +2 -2
- data/plugins/guests/redhat/cap/smb.rb +20 -0
- data/plugins/guests/redhat/plugin.rb +5 -0
- data/plugins/guests/slackware/cap/change_host_name.rb +11 -17
- data/plugins/guests/solaris11/plugin.rb +5 -0
- data/plugins/guests/suse/cap/change_host_name.rb +13 -12
- data/plugins/guests/windows/cap/public_key.rb +3 -3
- data/plugins/guests/windows/cap/reboot.rb +2 -1
- data/plugins/hosts/darwin/cap/fs_iso.rb +49 -0
- data/plugins/hosts/darwin/cap/nfs.rb +11 -0
- data/plugins/hosts/darwin/plugin.rb +15 -0
- data/plugins/hosts/linux/cap/fs_iso.rb +49 -0
- data/plugins/hosts/linux/cap/nfs.rb +21 -2
- data/plugins/hosts/linux/cap/rdp.rb +1 -1
- data/plugins/hosts/linux/plugin.rb +10 -0
- data/plugins/hosts/windows/cap/fs_iso.rb +48 -0
- data/plugins/hosts/windows/cap/rdp.rb +1 -1
- data/plugins/hosts/windows/plugin.rb +15 -0
- data/plugins/kernel_v2/config/cloud_init.rb +126 -0
- data/plugins/kernel_v2/config/disk.rb +221 -0
- data/plugins/kernel_v2/config/ssh_connect.rb +24 -0
- data/plugins/kernel_v2/config/vm.rb +225 -11
- data/plugins/kernel_v2/config/vm_provisioner.rb +17 -3
- data/plugins/kernel_v2/config/vm_trigger.rb +6 -5
- data/plugins/providers/docker/action.rb +8 -17
- data/plugins/providers/docker/action/forwarded_ports.rb +2 -0
- data/plugins/providers/docker/action/prepare_forwarded_port_collision_params.rb +61 -0
- data/plugins/providers/docker/cap/has_communicator.rb +11 -0
- data/plugins/providers/docker/communicator.rb +1 -1
- data/plugins/providers/docker/driver.rb +73 -10
- data/plugins/providers/docker/errors.rb +4 -0
- data/plugins/providers/docker/executor/local.rb +7 -1
- data/plugins/providers/docker/plugin.rb +5 -0
- data/plugins/providers/hyperv/action.rb +2 -0
- data/plugins/providers/hyperv/action/configure.rb +8 -0
- data/plugins/providers/hyperv/action/export.rb +4 -2
- data/plugins/providers/hyperv/cap/cleanup_disks.rb +54 -0
- data/plugins/providers/hyperv/cap/configure_disks.rb +200 -0
- data/plugins/providers/hyperv/cap/validate_disk_ext.rb +34 -0
- data/plugins/providers/hyperv/config.rb +5 -0
- data/plugins/providers/hyperv/driver.rb +90 -9
- data/plugins/providers/hyperv/plugin.rb +25 -0
- data/plugins/providers/hyperv/scripts/attach_disk_drive.ps1 +28 -0
- data/plugins/providers/hyperv/scripts/dismount_vhd.ps1 +13 -0
- data/plugins/providers/hyperv/scripts/get_vhd.ps1 +16 -0
- data/plugins/providers/hyperv/scripts/get_vm_status.ps1 +1 -1
- data/plugins/providers/hyperv/scripts/list_hdds.ps1 +17 -0
- data/plugins/providers/hyperv/scripts/new_vhd.ps1 +31 -0
- data/plugins/providers/hyperv/scripts/remove_disk_drive.ps1 +25 -0
- data/plugins/providers/hyperv/scripts/resize_disk_drive.ps1 +18 -0
- data/plugins/providers/hyperv/scripts/set_enhanced_session_transport_type.ps1 +24 -0
- data/plugins/providers/hyperv/scripts/set_vm_integration_services.ps1 +3 -3
- data/plugins/providers/hyperv/scripts/utils/VagrantVM/VagrantVM.psm1 +14 -6
- data/plugins/providers/virtualbox/action.rb +14 -1
- data/plugins/providers/virtualbox/action/clean_machine_folder.rb +10 -1
- data/plugins/providers/virtualbox/action/export.rb +4 -2
- data/plugins/providers/virtualbox/action/forward_ports.rb +2 -2
- data/plugins/providers/virtualbox/action/import.rb +8 -4
- data/plugins/providers/virtualbox/action/prepare_clone_snapshot.rb +4 -2
- data/plugins/providers/virtualbox/action/snapshot_delete.rb +4 -2
- data/plugins/providers/virtualbox/action/snapshot_restore.rb +4 -2
- data/plugins/providers/virtualbox/cap/cleanup_disks.rb +85 -0
- data/plugins/providers/virtualbox/cap/configure_disks.rb +440 -0
- data/plugins/providers/virtualbox/cap/mount_options.rb +35 -0
- data/plugins/providers/virtualbox/cap/validate_disk_ext.rb +34 -0
- data/plugins/providers/virtualbox/driver/base.rb +15 -0
- data/plugins/providers/virtualbox/driver/meta.rb +17 -2
- data/plugins/providers/virtualbox/driver/version_5_0.rb +217 -2
- data/plugins/providers/virtualbox/driver/version_6_1.rb +39 -0
- data/plugins/providers/virtualbox/model/storage_controller.rb +135 -0
- data/plugins/providers/virtualbox/model/storage_controller_array.rb +100 -0
- data/plugins/providers/virtualbox/plugin.rb +38 -0
- data/plugins/providers/virtualbox/synced_folder.rb +1 -0
- data/plugins/provisioners/ansible/cap/guest/alpine/ansible_install.rb +44 -0
- data/plugins/provisioners/ansible/cap/guest/arch/ansible_install.rb +20 -3
- data/plugins/provisioners/ansible/cap/guest/debian/ansible_install.rb +4 -5
- data/plugins/provisioners/ansible/cap/guest/fedora/ansible_install.rb +2 -2
- data/plugins/provisioners/ansible/cap/guest/freebsd/ansible_install.rb +2 -2
- data/plugins/provisioners/ansible/cap/guest/pip/pip.rb +8 -4
- data/plugins/provisioners/ansible/cap/guest/redhat/ansible_install.rb +2 -2
- data/plugins/provisioners/ansible/cap/guest/suse/ansible_install.rb +2 -1
- data/plugins/provisioners/ansible/cap/guest/ubuntu/ansible_install.rb +3 -3
- data/plugins/provisioners/ansible/plugin.rb +5 -0
- data/plugins/provisioners/ansible/provisioner/base.rb +1 -1
- data/plugins/provisioners/container/client.rb +203 -0
- data/plugins/provisioners/container/config.rb +83 -0
- data/plugins/provisioners/container/installer.rb +13 -0
- data/plugins/provisioners/container/plugin.rb +23 -0
- data/plugins/provisioners/container/provisioner.rb +28 -0
- data/plugins/provisioners/docker/cap/{redhat → centos}/docker_install.rb +10 -7
- data/plugins/provisioners/docker/cap/centos/docker_start_service.rb +24 -0
- data/plugins/provisioners/docker/client.rb +4 -175
- data/plugins/provisioners/docker/config.rb +2 -72
- data/plugins/provisioners/docker/installer.rb +3 -5
- data/plugins/provisioners/docker/plugin.rb +6 -6
- data/plugins/provisioners/docker/provisioner.rb +4 -10
- data/plugins/provisioners/podman/cap/centos/podman_install.rb +35 -0
- data/plugins/provisioners/podman/cap/linux/podman_installed.rb +13 -0
- data/plugins/provisioners/podman/cap/redhat/podman_install.rb +26 -0
- data/plugins/provisioners/podman/client.rb +12 -0
- data/plugins/provisioners/podman/config.rb +28 -0
- data/plugins/provisioners/podman/installer.rb +33 -0
- data/plugins/provisioners/podman/plugin.rb +38 -0
- data/plugins/provisioners/podman/provisioner.rb +52 -0
- data/plugins/provisioners/salt/provisioner.rb +4 -0
- data/plugins/provisioners/shell/config.rb +1 -6
- data/plugins/provisioners/shell/provisioner.rb +61 -26
- data/plugins/synced_folders/nfs/synced_folder.rb +3 -1
- data/plugins/synced_folders/smb/cap/default_fstab_modification.rb +11 -0
- data/plugins/synced_folders/smb/cap/mount_options.rb +36 -0
- data/plugins/synced_folders/smb/plugin.rb +10 -0
- data/plugins/synced_folders/smb/synced_folder.rb +2 -2
- data/plugins/synced_folders/unix_mount_helpers.rb +14 -0
- data/templates/commands/init/Vagrantfile.erb +1 -1
- data/templates/guests/arch/{network_dhcp.erb → default_network/network_dhcp.erb} +0 -0
- data/templates/guests/arch/{network_static.erb → default_network/network_static.erb} +0 -0
- data/templates/guests/arch/{network_static6.erb → default_network/network_static6.erb} +0 -0
- data/templates/guests/arch/systemd_networkd/network_dhcp.erb +6 -0
- data/templates/guests/arch/systemd_networkd/network_static.erb +9 -0
- data/templates/guests/arch/systemd_networkd/network_static6.erb +9 -0
- data/templates/guests/linux/etc_fstab.erb +6 -0
- data/templates/locales/en.yml +235 -6
- data/templates/locales/providers_docker.yml +6 -0
- data/templates/nfs/exports_darwin.erb +7 -0
- data/vagrant.gemspec +12 -12
- data/version.txt +1 -1
- metadata +3937 -3686
- data/lib/vagrant/action/builtin/after_trigger.rb +0 -31
- data/lib/vagrant/action/builtin/before_trigger.rb +0 -28
- data/plugins/provisioners/docker/cap/redhat/docker_start_service.rb +0 -16
@@ -1,30 +1,22 @@
|
|
1
|
+
require_relative '../../linux/cap/change_host_name'
|
2
|
+
|
1
3
|
module VagrantPlugins
|
2
4
|
module GuestGentoo
|
3
5
|
module Cap
|
4
6
|
class ChangeHostName
|
5
|
-
|
6
|
-
comm = machine.communicate
|
7
|
-
|
8
|
-
if !comm.test("hostname -f | grep '^#{name}$'", sudo: false)
|
9
|
-
basename = name.split(".", 2)[0]
|
10
|
-
comm.sudo <<-EOH.gsub(/^ {14}/, "")
|
11
|
-
# Set the hostname
|
12
|
-
|
13
|
-
# Use hostnamectl on systemd
|
14
|
-
if [[ `systemctl` =~ -\.mount ]]; then
|
15
|
-
systemctl set-hostname '#{name}'
|
16
|
-
else
|
17
|
-
hostname '#{basename}'
|
18
|
-
echo "hostname=#{basename}" > /etc/conf.d/hostname
|
19
|
-
fi
|
7
|
+
extend VagrantPlugins::GuestLinux::Cap::ChangeHostName
|
20
8
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
9
|
+
def self.change_name_command(name)
|
10
|
+
basename = name.split(".", 2)[0]
|
11
|
+
return <<-EOH.gsub(/^ {14}/, '')
|
12
|
+
# Use hostnamectl on systemd
|
13
|
+
if [[ `systemctl` =~ -\.mount ]]; then
|
14
|
+
systemctl set-hostname '#{name}'
|
15
|
+
else
|
16
|
+
hostname '#{basename}'
|
17
|
+
echo "hostname=#{basename}" > /etc/conf.d/hostname
|
18
|
+
fi
|
19
|
+
EOH
|
28
20
|
end
|
29
21
|
end
|
30
22
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module GuestHaiku
|
3
|
+
module Cap
|
4
|
+
class RSync
|
5
|
+
def self.rsync_installed(machine)
|
6
|
+
machine.communicate.test("test -f /bin/rsync")
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.rsync_install(machine)
|
10
|
+
machine.communicate.execute("pkgman install -y rsync")
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.rsync_command(machine)
|
14
|
+
"rsync -zz"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -30,6 +30,21 @@ module VagrantPlugins
|
|
30
30
|
require_relative "cap/remove_public_key"
|
31
31
|
Cap::RemovePublicKey
|
32
32
|
end
|
33
|
+
|
34
|
+
guest_capability(:haiku, :rsync_install) do
|
35
|
+
require_relative "cap/rsync"
|
36
|
+
Cap::RSync
|
37
|
+
end
|
38
|
+
|
39
|
+
guest_capability(:haiku, :rsync_installed) do
|
40
|
+
require_relative "cap/rsync"
|
41
|
+
Cap::RSync
|
42
|
+
end
|
43
|
+
|
44
|
+
guest_capability(:haiku, :rsync_command) do
|
45
|
+
require_relative "cap/rsync"
|
46
|
+
Cap::RSync
|
47
|
+
end
|
33
48
|
end
|
34
49
|
end
|
35
50
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'vagrant/util/guest_hosts'
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module GuestLinux
|
5
|
+
module Cap
|
6
|
+
module ChangeHostName
|
7
|
+
module Methods
|
8
|
+
def change_name_command(name)
|
9
|
+
return <<-EOH.gsub(/^ {14}/, '')
|
10
|
+
# Set the hostname
|
11
|
+
echo '#{name}' > /etc/hostname
|
12
|
+
hostname '#{name}'
|
13
|
+
EOH
|
14
|
+
end
|
15
|
+
|
16
|
+
def change_host_name?(comm, name)
|
17
|
+
!comm.test("hostname -f | grep '^#{name}$'", sudo: false)
|
18
|
+
end
|
19
|
+
|
20
|
+
def change_host_name(machine, name)
|
21
|
+
comm = machine.communicate
|
22
|
+
|
23
|
+
network_with_hostname = machine.config.vm.networks.map {|_, c| c if c[:hostname] }.compact[0]
|
24
|
+
if network_with_hostname
|
25
|
+
replace_host(comm, name, network_with_hostname[:ip])
|
26
|
+
else
|
27
|
+
add_hostname_to_loopback_interface(comm, name)
|
28
|
+
end
|
29
|
+
|
30
|
+
if change_host_name?(comm, name)
|
31
|
+
comm.sudo(change_name_command(name))
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.extended(klass)
|
37
|
+
klass.extend(Vagrant::Util::GuestHosts::Linux)
|
38
|
+
klass.extend(Methods)
|
39
|
+
end
|
40
|
+
|
41
|
+
extend Vagrant::Util::GuestHosts::Linux
|
42
|
+
extend Methods
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -1,10 +1,18 @@
|
|
1
|
+
require 'vagrant/util/guest_inspection'
|
2
|
+
|
1
3
|
module VagrantPlugins
|
2
4
|
module GuestLinux
|
3
5
|
module Cap
|
4
6
|
class Halt
|
7
|
+
extend Vagrant::Util::GuestInspection::Linux
|
8
|
+
|
5
9
|
def self.halt(machine)
|
6
10
|
begin
|
7
|
-
machine.communicate
|
11
|
+
if systemd?(machine.communicate)
|
12
|
+
machine.communicate.sudo("systemctl poweroff")
|
13
|
+
else
|
14
|
+
machine.communicate.sudo("shutdown -h now")
|
15
|
+
end
|
8
16
|
rescue IOError, Vagrant::Errors::SSHDisconnected
|
9
17
|
# Do nothing, because it probably means the machine shut down
|
10
18
|
# and SSH connection was lost.
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require "fileutils"
|
1
2
|
require "shellwords"
|
2
3
|
require_relative "../../../synced_folders/unix_mount_helpers"
|
3
4
|
|
@@ -34,10 +35,17 @@ module VagrantPlugins
|
|
34
35
|
mnt_opts << "credentials=/etc/smb_creds_#{name}"
|
35
36
|
mnt_opts << "uid=#{mount_uid}"
|
36
37
|
mnt_opts << "gid=#{mount_gid}"
|
38
|
+
if !ENV['VAGRANT_DISABLE_SMBMFSYMLINKS']
|
39
|
+
mnt_opts << "mfsymlinks"
|
40
|
+
end
|
37
41
|
|
38
42
|
mnt_opts = merge_mount_options(mnt_opts, options[:mount_options] || [])
|
39
43
|
|
40
44
|
mount_options = "-o #{mnt_opts.join(",")}"
|
45
|
+
if mount_options.include?("mfsymlinks")
|
46
|
+
display_mfsymlinks_warning(machine.env)
|
47
|
+
end
|
48
|
+
|
41
49
|
mount_command = "mount -t cifs #{mount_options} #{mount_device} #{expanded_guest_path}"
|
42
50
|
|
43
51
|
# Create the guest path if it doesn't exist
|
@@ -94,6 +102,14 @@ SCRIPT
|
|
94
102
|
[key, value].compact.join("=")
|
95
103
|
end
|
96
104
|
end
|
105
|
+
|
106
|
+
def self.display_mfsymlinks_warning(env)
|
107
|
+
d_file = env.data_dir.join("mfsymlinks_warning")
|
108
|
+
if !d_file.exist?
|
109
|
+
FileUtils.touch(d_file.to_path)
|
110
|
+
env.ui.warn(I18n.t("vagrant.actions.vm.smb.mfsymlink_warning"))
|
111
|
+
end
|
112
|
+
end
|
97
113
|
end
|
98
114
|
end
|
99
115
|
end
|
@@ -8,20 +8,14 @@ module VagrantPlugins
|
|
8
8
|
|
9
9
|
def self.mount_virtualbox_shared_folder(machine, name, guestpath, options)
|
10
10
|
guest_path = Shellwords.escape(guestpath)
|
11
|
+
mount_type = options[:plugin].capability(:mount_type)
|
11
12
|
|
12
13
|
@@logger.debug("Mounting #{name} (#{options[:hostpath]} to #{guestpath})")
|
13
14
|
|
14
|
-
builtin_mount_type = "-cit
|
15
|
-
addon_mount_type = "-t
|
15
|
+
builtin_mount_type = "-cit #{mount_type}"
|
16
|
+
addon_mount_type = "-t #{mount_type}"
|
16
17
|
|
17
|
-
mount_options = options.
|
18
|
-
detected_ids = detect_owner_group_ids(machine, guest_path, mount_options, options)
|
19
|
-
mount_uid = detected_ids[:uid]
|
20
|
-
mount_gid = detected_ids[:gid]
|
21
|
-
|
22
|
-
mount_options << "uid=#{mount_uid}"
|
23
|
-
mount_options << "gid=#{mount_gid}"
|
24
|
-
mount_options = mount_options.join(',')
|
18
|
+
mount_options, mount_uid, mount_gid = options[:plugin].capability(:mount_options, name, guest_path, options)
|
25
19
|
mount_command = "mount #{addon_mount_type} -o #{mount_options} #{name} #{guest_path}"
|
26
20
|
|
27
21
|
# Create the guest path if it doesn't exist
|
@@ -61,7 +55,6 @@ module VagrantPlugins
|
|
61
55
|
emit_upstart_notification(machine, guest_path)
|
62
56
|
end
|
63
57
|
|
64
|
-
|
65
58
|
def self.unmount_virtualbox_shared_folder(machine, guestpath, options)
|
66
59
|
guest_path = Shellwords.escape(guestpath)
|
67
60
|
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require "vagrant/util"
|
2
|
+
|
3
|
+
require_relative "../../../synced_folders/unix_mount_helpers"
|
4
|
+
|
5
|
+
module VagrantPlugins
|
6
|
+
module GuestLinux
|
7
|
+
module Cap
|
8
|
+
class PersistMountSharedFolder
|
9
|
+
extend SyncedFolder::UnixMountHelpers
|
10
|
+
|
11
|
+
# Inserts fstab entry for a set of synced folders. Will fully replace
|
12
|
+
# the currently managed group of Vagrant managed entries. Note, passing
|
13
|
+
# empty list of folders will just remove entries
|
14
|
+
#
|
15
|
+
# @param [Machine] machine The machine to run the action on
|
16
|
+
# @param [Map<String, Map>] A map of folders to add to fstab
|
17
|
+
def self.persist_mount_shared_folder(machine, folders)
|
18
|
+
if folders.nil?
|
19
|
+
self.remove_vagrant_managed_fstab(machine)
|
20
|
+
return
|
21
|
+
end
|
22
|
+
|
23
|
+
ssh_info = machine.ssh_info
|
24
|
+
export_folders = folders.map { |type, folder|
|
25
|
+
folder.map { |name, data|
|
26
|
+
guest_path = Shellwords.escape(data[:guestpath])
|
27
|
+
data[:owner] ||= ssh_info[:username]
|
28
|
+
data[:group] ||= ssh_info[:username]
|
29
|
+
|
30
|
+
if data[:plugin].capability?(:mount_type)
|
31
|
+
mount_type = data[:plugin].capability(:mount_type)
|
32
|
+
mount_options, _, _ = data[:plugin].capability(
|
33
|
+
:mount_options, name, guest_path, data)
|
34
|
+
else
|
35
|
+
next
|
36
|
+
end
|
37
|
+
|
38
|
+
mount_options = "#{mount_options},nofail"
|
39
|
+
{
|
40
|
+
name: name,
|
41
|
+
mount_point: guest_path,
|
42
|
+
mount_type: mount_type,
|
43
|
+
mount_options: mount_options,
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}.flatten.compact
|
47
|
+
|
48
|
+
|
49
|
+
fstab_entry = Vagrant::Util::TemplateRenderer.render('guests/linux/etc_fstab', folders: export_folders)
|
50
|
+
self.remove_vagrant_managed_fstab(machine)
|
51
|
+
machine.communicate.sudo("echo '#{fstab_entry}' >> /etc/fstab")
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def self.remove_vagrant_managed_fstab(machine)
|
57
|
+
machine.communicate.sudo("sed -i '/\#VAGRANT-BEGIN/,/\#VAGRANT-END/d' /etc/fstab")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'vagrant/util/guest_inspection'
|
2
|
+
require "log4r"
|
3
|
+
|
4
|
+
module VagrantPlugins
|
5
|
+
module GuestLinux
|
6
|
+
module Cap
|
7
|
+
class Reboot
|
8
|
+
extend Vagrant::Util::GuestInspection::Linux
|
9
|
+
MAX_REBOOT_RETRY_DURATION = 120
|
10
|
+
|
11
|
+
def self.reboot(machine)
|
12
|
+
@logger = Log4r::Logger.new("vagrant::linux::reboot")
|
13
|
+
if systemd?(machine.communicate)
|
14
|
+
reboot_script = "systemctl reboot"
|
15
|
+
else
|
16
|
+
reboot_script = "reboot"
|
17
|
+
end
|
18
|
+
|
19
|
+
comm = machine.communicate
|
20
|
+
|
21
|
+
@logger.debug("Issuing reboot command for guest")
|
22
|
+
comm.sudo(reboot_script)
|
23
|
+
|
24
|
+
machine.ui.info(I18n.t("vagrant.guests.capabilities.rebooting"))
|
25
|
+
|
26
|
+
@logger.debug("Waiting for machine to finish rebooting")
|
27
|
+
|
28
|
+
wait_remaining = MAX_REBOOT_RETRY_DURATION
|
29
|
+
begin
|
30
|
+
wait_for_reboot(machine)
|
31
|
+
rescue Vagrant::Errors::MachineGuestNotReady => e
|
32
|
+
raise if wait_remaining < 0
|
33
|
+
@logger.warn("Machine not ready, cannot start reboot yet. Trying again")
|
34
|
+
sleep(5)
|
35
|
+
wait_remaining -= 5
|
36
|
+
retry
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.wait_for_reboot(machine)
|
41
|
+
while !machine.guest.ready?
|
42
|
+
sleep 10
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -11,6 +11,11 @@ module VagrantPlugins
|
|
11
11
|
Guest
|
12
12
|
end
|
13
13
|
|
14
|
+
guest_capability(:linux, :change_host_name) do
|
15
|
+
require_relative "cap/change_host_name"
|
16
|
+
Cap::ChangeHostName
|
17
|
+
end
|
18
|
+
|
14
19
|
guest_capability(:linux, :choose_addressable_ip_addr) do
|
15
20
|
require_relative "cap/choose_addressable_ip_addr"
|
16
21
|
Cap::ChooseAddressableIPAddr
|
@@ -61,6 +66,11 @@ module VagrantPlugins
|
|
61
66
|
Cap::MountVirtualBoxSharedFolder
|
62
67
|
end
|
63
68
|
|
69
|
+
guest_capability(:linux, :persist_mount_shared_folder) do
|
70
|
+
require_relative "cap/persist_mount_shared_folder"
|
71
|
+
Cap::PersistMountSharedFolder
|
72
|
+
end
|
73
|
+
|
64
74
|
guest_capability(:linux, :network_interfaces) do
|
65
75
|
require_relative "cap/network_interfaces"
|
66
76
|
Cap::NetworkInterfaces
|
@@ -82,6 +92,16 @@ module VagrantPlugins
|
|
82
92
|
Cap::ReadIPAddress
|
83
93
|
end
|
84
94
|
|
95
|
+
guest_capability(:linux, :wait_for_reboot) do
|
96
|
+
require_relative "cap/reboot"
|
97
|
+
Cap::Reboot
|
98
|
+
end
|
99
|
+
|
100
|
+
guest_capability(:linux, :reboot) do
|
101
|
+
require_relative "cap/reboot"
|
102
|
+
Cap::Reboot
|
103
|
+
end
|
104
|
+
|
85
105
|
guest_capability(:linux, :remove_public_key) do
|
86
106
|
require_relative "cap/public_key"
|
87
107
|
Cap::PublicKey
|
@@ -1,24 +1,18 @@
|
|
1
|
+
require_relative '../../linux/cap/change_host_name'
|
2
|
+
|
1
3
|
module VagrantPlugins
|
2
4
|
module GuestOmniOS
|
3
5
|
module Cap
|
4
6
|
class ChangeHostName
|
5
|
-
|
6
|
-
comm = machine.communicate
|
7
|
-
|
8
|
-
if !comm.test("hostname -f | grep '^#{name}$'", sudo: false)
|
9
|
-
basename = name.split(".", 2)[0]
|
10
|
-
comm.sudo <<-EOH.gsub(/^ {14}/, '')
|
11
|
-
# Set hostname
|
12
|
-
echo '#{name}' > /etc/nodename
|
13
|
-
hostname '#{name}'
|
7
|
+
extend VagrantPlugins::GuestLinux::Cap::ChangeHostName
|
14
8
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
9
|
+
def self.change_name_command(name)
|
10
|
+
basename = name.split(".", 2)[0]
|
11
|
+
return <<-EOH.gsub(/^ {14}/, "")
|
12
|
+
# Set hostname
|
13
|
+
echo '#{name}' > /etc/nodename
|
14
|
+
hostname '#{name}'
|
15
|
+
EOH
|
22
16
|
end
|
23
17
|
end
|
24
18
|
end
|
@@ -1,7 +1,11 @@
|
|
1
|
+
require 'vagrant/util/guest_hosts'
|
2
|
+
|
1
3
|
module VagrantPlugins
|
2
4
|
module GuestOpenBSD
|
3
5
|
module Cap
|
4
6
|
class ChangeHostName
|
7
|
+
extend Vagrant::Util::GuestHosts::BSD
|
8
|
+
|
5
9
|
def self.change_host_name(machine, name)
|
6
10
|
comm = machine.communicate
|
7
11
|
|
@@ -12,15 +16,15 @@ module VagrantPlugins
|
|
12
16
|
hostname '#{name}'
|
13
17
|
sed -i'' 's/^hostname=.*$/hostname=\"#{name}\"/' /etc/rc.conf
|
14
18
|
echo '#{name}' > /etc/myname
|
15
|
-
|
16
|
-
# Prepend ourselves to /etc/hosts
|
17
|
-
grep -w '#{name}' /etc/hosts || {
|
18
|
-
echo -e '127.0.0.1\\t#{name}\\t#{basename}' | cat - /etc/hosts > /tmp/tmp-hosts
|
19
|
-
mv /tmp/tmp-hosts /etc/hosts
|
20
|
-
}
|
21
19
|
EOH
|
22
20
|
comm.sudo(command, shell: "sh")
|
23
21
|
end
|
22
|
+
network_with_hostname = machine.config.vm.networks.map {|_, c| c if c[:hostname] }.compact[0]
|
23
|
+
if network_with_hostname
|
24
|
+
replace_host(comm, name, network_with_hostname[:ip])
|
25
|
+
else
|
26
|
+
add_hostname_to_loopback_interface(comm, name)
|
27
|
+
end
|
24
28
|
end
|
25
29
|
end
|
26
30
|
end
|