vagrant-unbundled 2.2.9.0 → 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/CHANGELOG.md +60 -0
- data/README.md +5 -5
- data/contrib/README.md +1 -0
- 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/action.rb +3 -0
- data/lib/vagrant/action/builder.rb +52 -18
- data/lib/vagrant/action/builtin/box_add.rb +6 -5
- 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/handle_box.rb +1 -1
- data/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb +13 -13
- data/lib/vagrant/action/builtin/has_provisioner.rb +36 -0
- data/lib/vagrant/action/builtin/mixin_provisioners.rb +1 -0
- 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/synced_folders.rb +10 -0
- data/lib/vagrant/action/builtin/trigger.rb +3 -2
- data/lib/vagrant/action/hook.rb +59 -24
- data/lib/vagrant/action/warden.rb +25 -5
- data/lib/vagrant/box.rb +5 -4
- data/lib/vagrant/bundler.rb +6 -1
- data/lib/vagrant/errors.rb +37 -1
- data/lib/vagrant/machine.rb +47 -0
- data/lib/vagrant/machine_index.rb +27 -1
- data/lib/vagrant/plugin/v2/command.rb +5 -1
- data/lib/vagrant/plugin/v2/components.rb +6 -0
- data/lib/vagrant/plugin/v2/manager.rb +14 -0
- data/lib/vagrant/plugin/v2/plugin.rb +12 -0
- data/lib/vagrant/plugin/v2/synced_folder.rb +50 -0
- data/lib/vagrant/plugin/v2/trigger.rb +6 -5
- data/lib/vagrant/ui.rb +1 -1
- 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/directory.rb +19 -0
- data/lib/vagrant/util/downloader.rb +3 -3
- data/lib/vagrant/util/guest_hosts.rb +68 -0
- data/lib/vagrant/util/install_cli_autocomplete.rb +118 -0
- data/lib/vagrant/util/ipv4_interfaces.rb +15 -0
- data/lib/vagrant/util/is_port_open.rb +8 -19
- data/lib/vagrant/util/network_ip.rb +11 -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/destroy/command.rb +6 -2
- data/plugins/communicators/ssh/communicator.rb +7 -1
- data/plugins/communicators/winrm/helper.rb +1 -1
- data/plugins/communicators/winssh/communicator.rb +1 -1
- data/plugins/guests/alpine/cap/change_host_name.rb +10 -11
- 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/darwin/cap/change_host_name.rb +10 -6
- data/plugins/guests/debian/cap/change_host_name.rb +11 -11
- 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/mount_virtualbox_shared_folder.rb +4 -11
- data/plugins/guests/linux/cap/persist_mount_shared_folder.rb +62 -0
- data/plugins/guests/linux/plugin.rb +10 -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/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 +12 -11
- data/plugins/hosts/darwin/cap/fs_iso.rb +49 -0
- data/plugins/hosts/darwin/plugin.rb +10 -0
- data/plugins/hosts/linux/cap/fs_iso.rb +49 -0
- 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 +40 -18
- data/plugins/kernel_v2/config/vm.rb +122 -13
- data/plugins/kernel_v2/config/vm_provisioner.rb +13 -2
- data/plugins/kernel_v2/config/vm_trigger.rb +5 -1
- 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 +35 -0
- 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/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 +80 -0
- 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/utils/VagrantVM/VagrantVM.psm1 +8 -0
- data/plugins/providers/virtualbox/action.rb +12 -1
- data/plugins/providers/virtualbox/action/forward_ports.rb +2 -2
- data/plugins/providers/virtualbox/cap/cleanup_disks.rb +40 -9
- data/plugins/providers/virtualbox/cap/configure_disks.rb +230 -77
- data/plugins/providers/virtualbox/cap/mount_options.rb +35 -0
- data/plugins/providers/virtualbox/cap/validate_disk_ext.rb +10 -3
- data/plugins/providers/virtualbox/driver/meta.rb +3 -0
- data/plugins/providers/virtualbox/driver/version_5_0.rb +96 -21
- 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 +18 -1
- data/plugins/providers/virtualbox/synced_folder.rb +1 -0
- data/plugins/provisioners/container/client.rb +1 -1
- data/plugins/provisioners/shell/provisioner.rb +15 -9
- 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 +1 -1
- data/plugins/synced_folders/unix_mount_helpers.rb +14 -0
- 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 +121 -11
- data/templates/locales/providers_docker.yml +4 -0
- data/vagrant.gemspec +8 -7
- data/version.txt +1 -1
- metadata +1492 -1309
@@ -1,27 +1,21 @@
|
|
1
|
+
require_relative '../../linux/cap/change_host_name'
|
2
|
+
|
1
3
|
module VagrantPlugins
|
2
4
|
module GuestPld
|
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
|
-
hostname '#{name}'
|
12
|
-
sed -i 's/\\(HOSTNAME=\\).*/\\1#{name}/' /etc/sysconfig/network
|
7
|
+
extend VagrantPlugins::GuestLinux::Cap::ChangeHostName
|
13
8
|
|
14
|
-
|
9
|
+
def self.change_name_command(name)
|
10
|
+
return <<-EOH.gsub(/^ {14}/, "")
|
11
|
+
hostname '#{name}'
|
12
|
+
sed -i 's/\\(HOSTNAME=\\).*/\\1#{name}/' /etc/sysconfig/network
|
15
13
|
|
16
|
-
|
17
|
-
grep -w '#{name}' /etc/hosts || {
|
18
|
-
sed -i'' '1i 127.0.0.1\\t#{name}\\t#{basename}' /etc/hosts
|
19
|
-
}
|
14
|
+
sed -i 's/\\(DHCP_HOSTNAME=\\).*/\\1\"#{name}\"/' /etc/sysconfig/interfaces/ifcfg-*
|
20
15
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
16
|
+
# Restart networking
|
17
|
+
service network restart
|
18
|
+
EOH
|
25
19
|
end
|
26
20
|
end
|
27
21
|
end
|
@@ -1,9 +1,12 @@
|
|
1
|
+
require 'vagrant/util/guest_hosts'
|
2
|
+
|
1
3
|
module VagrantPlugins
|
2
4
|
module GuestRedHat
|
3
5
|
module Cap
|
4
6
|
class ChangeHostName
|
5
7
|
|
6
8
|
extend Vagrant::Util::GuestInspection::Linux
|
9
|
+
extend Vagrant::Util::GuestHosts::Linux
|
7
10
|
|
8
11
|
def self.change_host_name(machine, name)
|
9
12
|
comm = machine.communicate
|
@@ -15,11 +18,6 @@ module VagrantPlugins
|
|
15
18
|
sed -i 's/\\(HOSTNAME=\\).*/\\1#{name}/' /etc/sysconfig/network
|
16
19
|
# Update DNS
|
17
20
|
sed -i 's/\\(DHCP_HOSTNAME=\\).*/\\1\"#{basename}\"/' /etc/sysconfig/network-scripts/ifcfg-*
|
18
|
-
# Set the hostname - use hostnamectl if available
|
19
|
-
echo '#{name}' > /etc/hostname
|
20
|
-
grep -w '#{name}' /etc/hosts || {
|
21
|
-
sed -i'' '1i 127.0.0.1\\t#{name}\\t#{basename}' /etc/hosts
|
22
|
-
}
|
23
21
|
EOH
|
24
22
|
|
25
23
|
if hostnamectl?(comm)
|
@@ -40,6 +38,13 @@ module VagrantPlugins
|
|
40
38
|
end
|
41
39
|
comm.sudo(restart_command)
|
42
40
|
end
|
41
|
+
|
42
|
+
network_with_hostname = machine.config.vm.networks.map {|_, c| c if c[:hostname] }.compact[0]
|
43
|
+
if network_with_hostname
|
44
|
+
replace_host(comm, name, network_with_hostname[:ip])
|
45
|
+
else
|
46
|
+
add_hostname_to_loopback_interface(comm, name)
|
47
|
+
end
|
43
48
|
end
|
44
49
|
end
|
45
50
|
end
|
@@ -1,25 +1,19 @@
|
|
1
|
+
require_relative '../../linux/cap/change_host_name'
|
2
|
+
|
1
3
|
module VagrantPlugins
|
2
4
|
module GuestSlackware
|
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
|
-
chmod o+w /etc/hostname
|
13
|
-
echo '#{name}' > /etc/hostname
|
14
|
-
chmod o-w /etc/hostname
|
15
|
-
hostname -F /etc/hostname
|
7
|
+
extend VagrantPlugins::GuestLinux::Cap::ChangeHostName
|
16
8
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
9
|
+
def self.change_name_command(name)
|
10
|
+
return <<-EOH.gsub(/^ {14}/, "")
|
11
|
+
# Set the hostname
|
12
|
+
chmod o+w /etc/hostname
|
13
|
+
echo '#{name}' > /etc/hostname
|
14
|
+
chmod o-w /etc/hostname
|
15
|
+
hostname -F /etc/hostname
|
16
|
+
EOH
|
23
17
|
end
|
24
18
|
end
|
25
19
|
end
|
@@ -29,6 +29,11 @@ module VagrantPlugins
|
|
29
29
|
require_relative "cap/configure_networks"
|
30
30
|
Cap::ConfigureNetworks
|
31
31
|
end
|
32
|
+
|
33
|
+
guest_capability(:solaris11, :shell_expand_guest_path) do
|
34
|
+
require_relative "../linux/cap/shell_expand_guest_path"
|
35
|
+
VagrantPlugins::GuestLinux::Cap::ShellExpandGuestPath
|
36
|
+
end
|
32
37
|
end
|
33
38
|
end
|
34
39
|
end
|
@@ -1,21 +1,22 @@
|
|
1
|
+
require_relative '../../linux/cap/change_host_name'
|
2
|
+
|
1
3
|
module VagrantPlugins
|
2
4
|
module GuestSUSE
|
3
5
|
module Cap
|
4
6
|
class ChangeHostName
|
5
|
-
|
6
|
-
comm = machine.communicate
|
7
|
+
extend VagrantPlugins::GuestLinux::Cap::ChangeHostName
|
7
8
|
|
9
|
+
def self.change_host_name?(comm, name)
|
8
10
|
basename = name.split(".", 2)[0]
|
9
|
-
|
10
|
-
|
11
|
-
hostnamectl set-hostname '#{basename}'
|
11
|
+
!comm.test("test \"$(hostnamectl --static status)\" = \"#{basename}\"", sudo: false)
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
def self.change_name_command(name)
|
15
|
+
basename = name.split(".", 2)[0]
|
16
|
+
return <<-EOH.gsub(/^ {14}/, "")
|
17
|
+
hostnamectl set-hostname '#{basename}'
|
18
|
+
echo #{name} > /etc/HOSTNAME
|
19
|
+
EOH
|
19
20
|
end
|
20
21
|
end
|
21
22
|
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require "pathname"
|
2
|
+
require "vagrant/util/caps"
|
3
|
+
|
4
|
+
module VagrantPlugins
|
5
|
+
module HostDarwin
|
6
|
+
module Cap
|
7
|
+
class FsISO
|
8
|
+
extend Vagrant::Util::Caps::BuildISO
|
9
|
+
|
10
|
+
@@logger = Log4r::Logger.new("vagrant::host::darwin::fs_iso")
|
11
|
+
|
12
|
+
BUILD_ISO_CMD = "hdiutil".freeze
|
13
|
+
|
14
|
+
# Check that the host has the ability to generate ISOs
|
15
|
+
#
|
16
|
+
# @param [Vagrant::Environment] env
|
17
|
+
# @return [Boolean]
|
18
|
+
def self.isofs_available(env)
|
19
|
+
!!Vagrant::Util::Which.which(BUILD_ISO_CMD)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Generate an ISO file of the given source directory
|
23
|
+
#
|
24
|
+
# @param [Vagrant::Environment] env
|
25
|
+
# @param [String] source_directory Contents of ISO
|
26
|
+
# @param [Map] extra arguments to pass to the iso building command
|
27
|
+
# :file_destination (string) location to store ISO
|
28
|
+
# :volume_id (String) to set the volume name
|
29
|
+
# @return [Pathname] ISO location
|
30
|
+
# @note If file_destination exists, source_directory will be checked
|
31
|
+
# for recent modifications and a new ISO will be generated if requried.
|
32
|
+
def self.create_iso(env, source_directory, extra_opts={})
|
33
|
+
source_directory = Pathname.new(source_directory)
|
34
|
+
file_destination = self.ensure_output_iso(extra_opts[:file_destination])
|
35
|
+
|
36
|
+
iso_command = [BUILD_ISO_CMD, "makehybrid", "-hfs", "-iso", "-joliet", "-ov"]
|
37
|
+
iso_command.concat(["-default-volume-name", extra_opts[:volume_id]]) if extra_opts[:volume_id]
|
38
|
+
iso_command << "-o"
|
39
|
+
iso_command << file_destination.to_s
|
40
|
+
iso_command << source_directory.to_s
|
41
|
+
self.build_iso(iso_command, source_directory, file_destination)
|
42
|
+
|
43
|
+
@@logger.info("ISO available at #{file_destination}")
|
44
|
+
file_destination
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -11,6 +11,16 @@ module VagrantPlugins
|
|
11
11
|
Host
|
12
12
|
end
|
13
13
|
|
14
|
+
host_capability("darwin", "isofs_available") do
|
15
|
+
require_relative "cap/fs_iso"
|
16
|
+
Cap::FsISO
|
17
|
+
end
|
18
|
+
|
19
|
+
host_capability("darwin", "create_iso") do
|
20
|
+
require_relative "cap/fs_iso"
|
21
|
+
Cap::FsISO
|
22
|
+
end
|
23
|
+
|
14
24
|
host_capability("darwin", "provider_install_virtualbox") do
|
15
25
|
require_relative "cap/provider_install_virtualbox"
|
16
26
|
Cap::ProviderInstallVirtualBox
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require "pathname"
|
2
|
+
require "vagrant/util/caps"
|
3
|
+
|
4
|
+
module VagrantPlugins
|
5
|
+
module HostLinux
|
6
|
+
module Cap
|
7
|
+
class FsISO
|
8
|
+
extend Vagrant::Util::Caps::BuildISO
|
9
|
+
|
10
|
+
@@logger = Log4r::Logger.new("vagrant::host::linux::fs_iso")
|
11
|
+
|
12
|
+
BUILD_ISO_CMD = "mkisofs".freeze
|
13
|
+
|
14
|
+
# Check that the host has the ability to generate ISOs
|
15
|
+
#
|
16
|
+
# @param [Vagrant::Environment] env
|
17
|
+
# @return [Boolean]
|
18
|
+
def self.isofs_available(env)
|
19
|
+
!!Vagrant::Util::Which.which(BUILD_ISO_CMD)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Generate an ISO file of the given source directory
|
23
|
+
#
|
24
|
+
# @param [Vagrant::Environment] env
|
25
|
+
# @param [String] source_directory Contents of ISO
|
26
|
+
# @param [Map] extra arguments to pass to the iso building command
|
27
|
+
# :file_destination (string) location to store ISO
|
28
|
+
# :volume_id (String) to set the volume name
|
29
|
+
# @return [Pathname] ISO location
|
30
|
+
# @note If file_destination exists, source_directory will be checked
|
31
|
+
# for recent modifications and a new ISO will be generated if requried.
|
32
|
+
def self.create_iso(env, source_directory, extra_opts={})
|
33
|
+
source_directory = Pathname.new(source_directory)
|
34
|
+
file_destination = self.ensure_output_iso(extra_opts[:file_destination])
|
35
|
+
|
36
|
+
iso_command = [BUILD_ISO_CMD, "-joliet"]
|
37
|
+
iso_command.concat(["-volid", extra_opts[:volume_id]]) if extra_opts[:volume_id]
|
38
|
+
iso_command << "-o"
|
39
|
+
iso_command << file_destination.to_s
|
40
|
+
iso_command << source_directory.to_s
|
41
|
+
self.build_iso(iso_command, source_directory, file_destination)
|
42
|
+
|
43
|
+
@@logger.info("ISO available at #{file_destination}")
|
44
|
+
file_destination
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -11,6 +11,16 @@ module VagrantPlugins
|
|
11
11
|
Host
|
12
12
|
end
|
13
13
|
|
14
|
+
host_capability("linux", "isofs_available") do
|
15
|
+
require_relative "cap/fs_iso"
|
16
|
+
Cap::FsISO
|
17
|
+
end
|
18
|
+
|
19
|
+
host_capability("linux", "create_iso") do
|
20
|
+
require_relative "cap/fs_iso"
|
21
|
+
Cap::FsISO
|
22
|
+
end
|
23
|
+
|
14
24
|
host_capability("linux", "nfs_export") do
|
15
25
|
require_relative "cap/nfs"
|
16
26
|
Cap::NFS
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require "pathname"
|
2
|
+
require "vagrant/util/caps"
|
3
|
+
|
4
|
+
module VagrantPlugins
|
5
|
+
module HostWindows
|
6
|
+
module Cap
|
7
|
+
class FsISO
|
8
|
+
extend Vagrant::Util::Caps::BuildISO
|
9
|
+
|
10
|
+
@@logger = Log4r::Logger.new("vagrant::host::windows::fs_iso")
|
11
|
+
|
12
|
+
BUILD_ISO_CMD = "oscdimg".freeze
|
13
|
+
|
14
|
+
# Check that the host has the ability to generate ISOs
|
15
|
+
#
|
16
|
+
# @param [Vagrant::Environment] env
|
17
|
+
# @return [Boolean]
|
18
|
+
def self.isofs_available(env)
|
19
|
+
!!Vagrant::Util::Which.which(BUILD_ISO_CMD)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Generate an ISO file of the given source directory
|
23
|
+
#
|
24
|
+
# @param [Vagrant::Environment] env
|
25
|
+
# @param [String] source_directory Contents of ISO
|
26
|
+
# @param [Map] extra arguments to pass to the iso building command
|
27
|
+
# :file_destination (string) location to store ISO
|
28
|
+
# :volume_id (String) to set the volume name
|
29
|
+
# @return [Pathname] ISO location
|
30
|
+
# @note If file_destination exists, source_directory will be checked
|
31
|
+
# for recent modifications and a new ISO will be generated if requried.
|
32
|
+
def self.create_iso(env, source_directory, extra_opts={})
|
33
|
+
source_directory = Pathname.new(source_directory)
|
34
|
+
file_destination = self.ensure_output_iso(extra_opts[:file_destination])
|
35
|
+
|
36
|
+
iso_command = [BUILD_ISO_CMD, "-j1", "-o", "-m"]
|
37
|
+
iso_command << "-l#{extra_opts[:volume_id]}" if extra_opts[:volume_id]
|
38
|
+
iso_command << source_directory.to_s
|
39
|
+
iso_command << file_destination.to_s
|
40
|
+
self.build_iso(iso_command, source_directory, file_destination)
|
41
|
+
|
42
|
+
@@logger.info("ISO available at #{file_destination}")
|
43
|
+
file_destination
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -11,6 +11,16 @@ module VagrantPlugins
|
|
11
11
|
Host
|
12
12
|
end
|
13
13
|
|
14
|
+
host_capability("windows", "isofs_available") do
|
15
|
+
require_relative "cap/fs_iso"
|
16
|
+
Cap::FsISO
|
17
|
+
end
|
18
|
+
|
19
|
+
host_capability("windows", "create_iso") do
|
20
|
+
require_relative "cap/fs_iso"
|
21
|
+
Cap::FsISO
|
22
|
+
end
|
23
|
+
|
14
24
|
host_capability("windows", "provider_install_virtualbox") do
|
15
25
|
require_relative "cap/provider_install_virtualbox"
|
16
26
|
Cap::ProviderInstallVirtualBox
|
@@ -60,6 +70,11 @@ module VagrantPlugins
|
|
60
70
|
require_relative "cap/ssh"
|
61
71
|
Cap::SSH
|
62
72
|
end
|
73
|
+
|
74
|
+
host_capability("windows", "smb_validate_password") do
|
75
|
+
require_relative "cap/smb"
|
76
|
+
Cap::SMB
|
77
|
+
end
|
63
78
|
end
|
64
79
|
end
|
65
80
|
end
|
@@ -0,0 +1,126 @@
|
|
1
|
+
require "log4r"
|
2
|
+
require "securerandom"
|
3
|
+
|
4
|
+
module VagrantPlugins
|
5
|
+
module Kernel_V2
|
6
|
+
class VagrantConfigCloudInit < Vagrant.plugin("2", :config)
|
7
|
+
#-------------------------------------------------------------------
|
8
|
+
# Config class for cloud-init
|
9
|
+
#-------------------------------------------------------------------
|
10
|
+
|
11
|
+
DEFAULT_CONTENT_TYPES = ["text/cloud-boothook", "text/cloud-config",
|
12
|
+
"text/cloud-config-archive", "text/jinja2",
|
13
|
+
"text/part-handler", "text/upstart-job",
|
14
|
+
"text/x-include-once-url", "text/x-include-url",
|
15
|
+
"text/x-shellscript"].map(&:freeze).freeze
|
16
|
+
|
17
|
+
DEFAULT_CONFIG_TYPE = :user_data
|
18
|
+
|
19
|
+
# @note This value is for internal use only
|
20
|
+
#
|
21
|
+
# @return [String]
|
22
|
+
attr_reader :id
|
23
|
+
|
24
|
+
# The 'type' of data being stored. If not defined,
|
25
|
+
# will default to :user_data
|
26
|
+
#
|
27
|
+
# @return [Symbol]
|
28
|
+
attr_accessor :type
|
29
|
+
|
30
|
+
# @return [String]
|
31
|
+
attr_accessor :content_type
|
32
|
+
|
33
|
+
# @return [String]
|
34
|
+
attr_accessor :path
|
35
|
+
|
36
|
+
# @return [String]
|
37
|
+
attr_accessor :inline
|
38
|
+
|
39
|
+
def initialize(type=nil)
|
40
|
+
@logger = Log4r::Logger.new("vagrant::config::vm::cloud_init")
|
41
|
+
|
42
|
+
@type = type if type
|
43
|
+
|
44
|
+
@content_type = UNSET_VALUE
|
45
|
+
@path = UNSET_VALUE
|
46
|
+
@inline = UNSET_VALUE
|
47
|
+
|
48
|
+
# Internal options
|
49
|
+
@id = SecureRandom.uuid
|
50
|
+
end
|
51
|
+
|
52
|
+
def finalize!
|
53
|
+
if !@type
|
54
|
+
@type = DEFAULT_CONFIG_TYPE
|
55
|
+
else
|
56
|
+
@type = @type.to_sym
|
57
|
+
end
|
58
|
+
|
59
|
+
@content_type = nil if @content_type == UNSET_VALUE
|
60
|
+
@path = nil if @path == UNSET_VALUE
|
61
|
+
@inline = nil if @inline == UNSET_VALUE
|
62
|
+
end
|
63
|
+
|
64
|
+
# @return [Array] array of strings of error messages from config option validation
|
65
|
+
def validate(machine)
|
66
|
+
errors = _detected_errors
|
67
|
+
|
68
|
+
if @type && @type != DEFAULT_CONFIG_TYPE
|
69
|
+
errors << I18n.t("vagrant.cloud_init.incorrect_type_set",
|
70
|
+
type: @type,
|
71
|
+
machine: machine.name,
|
72
|
+
default_type: DEFAULT_CONFIG_TYPE)
|
73
|
+
end
|
74
|
+
|
75
|
+
if !@content_type
|
76
|
+
errors << I18n.t("vagrant.cloud_init.content_type_not_set",
|
77
|
+
machine: machine.name,
|
78
|
+
accepted_types: DEFAULT_CONTENT_TYPES.join(', '))
|
79
|
+
elsif !DEFAULT_CONTENT_TYPES.include?(@content_type)
|
80
|
+
errors << I18n.t("vagrant.cloud_init.incorrect_content_type",
|
81
|
+
machine: machine.name,
|
82
|
+
content_type: @content_type,
|
83
|
+
accepted_types: DEFAULT_CONTENT_TYPES.join(', '))
|
84
|
+
end
|
85
|
+
|
86
|
+
if @path && @inline
|
87
|
+
errors << I18n.t("vagrant.cloud_init.path_and_inline_set",
|
88
|
+
machine: machine.name)
|
89
|
+
end
|
90
|
+
|
91
|
+
if @path
|
92
|
+
if !@path.is_a?(String)
|
93
|
+
errors << I18n.t("vagrant.cloud_init.incorrect_path_type",
|
94
|
+
machine: machine.name,
|
95
|
+
path: @path,
|
96
|
+
type: @path.class.name)
|
97
|
+
else
|
98
|
+
expanded_path = Pathname.new(@path).expand_path(machine.env.root_path)
|
99
|
+
if !expanded_path.file?
|
100
|
+
errors << I18n.t("vagrant.cloud_init.path_invalid",
|
101
|
+
path: expanded_path,
|
102
|
+
machine: machine.name)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
if @inline
|
108
|
+
if !@inline.is_a?(String)
|
109
|
+
errors << I18n.t("vagrant.cloud_init.incorrect_inline_type",
|
110
|
+
machine: machine.name,
|
111
|
+
type: @inline.class.name)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
errors
|
116
|
+
end
|
117
|
+
|
118
|
+
# The String representation of this config.
|
119
|
+
#
|
120
|
+
# @return [String]
|
121
|
+
def to_s
|
122
|
+
"cloud_init config"
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|