vagrant-unbundled 2.2.6.0 → 2.2.9.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 +93 -2
- data/README.md +1 -3
- data/bin/vagrant +23 -0
- data/contrib/bash/completion.sh +13 -1
- data/lib/vagrant.rb +25 -0
- data/lib/vagrant/action.rb +5 -0
- data/lib/vagrant/action/builder.rb +145 -24
- data/lib/vagrant/action/builtin/box_add.rb +11 -4
- 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/delayed.rb +26 -0
- data/lib/vagrant/action/builtin/disk.rb +52 -0
- data/lib/vagrant/action/builtin/handle_box.rb +2 -0
- data/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb +28 -9
- data/lib/vagrant/action/builtin/mixin_provisioners.rb +19 -1
- data/lib/vagrant/action/builtin/ssh_run.rb +21 -3
- data/lib/vagrant/action/builtin/trigger.rb +36 -0
- data/lib/vagrant/action/hook.rb +20 -2
- data/lib/vagrant/action/runner.rb +11 -26
- data/lib/vagrant/action/warden.rb +4 -18
- data/lib/vagrant/box_metadata.rb +17 -3
- data/lib/vagrant/bundler.rb +260 -53
- data/lib/vagrant/cli.rb +4 -2
- data/lib/vagrant/errors.rb +24 -0
- data/lib/vagrant/machine.rb +9 -6
- data/lib/vagrant/plugin/manager.rb +25 -14
- data/lib/vagrant/plugin/v2/command.rb +1 -1
- data/lib/vagrant/plugin/v2/manager.rb +53 -0
- data/lib/vagrant/plugin/v2/plugin.rb +1 -0
- data/lib/vagrant/plugin/v2/trigger.rb +64 -26
- data/lib/vagrant/shared_helpers.rb +28 -0
- data/lib/vagrant/ui.rb +50 -4
- data/lib/vagrant/util.rb +1 -0
- data/lib/vagrant/util/curl_helper.rb +8 -5
- data/lib/vagrant/util/downloader.rb +5 -1
- data/lib/vagrant/util/file_checksum.rb +6 -2
- data/lib/vagrant/util/guest_inspection.rb +9 -1
- data/lib/vagrant/util/io.rb +7 -27
- data/lib/vagrant/util/is_port_open.rb +1 -2
- data/lib/vagrant/util/map_command_options.rb +33 -0
- data/lib/vagrant/util/numeric.rb +69 -0
- data/lib/vagrant/util/platform.rb +8 -1
- 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/snapshot/command/save.rb +13 -8
- data/plugins/commands/ssh_config/command.rb +1 -1
- data/plugins/communicators/ssh/communicator.rb +18 -23
- data/plugins/communicators/winrm/config.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/rsync.rb +1 -1
- data/plugins/guests/alpine/plugin.rb +16 -0
- 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/mount_vmware_shared_folder.rb +99 -13
- data/plugins/guests/darwin/plugin.rb +5 -0
- data/plugins/guests/debian/cap/configure_networks.rb +14 -6
- 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/reboot.rb +48 -0
- data/plugins/guests/linux/plugin.rb +10 -0
- 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/suse/cap/change_host_name.rb +2 -2
- data/plugins/guests/windows/cap/public_key.rb +3 -3
- data/plugins/guests/windows/cap/reboot.rb +2 -1
- data/plugins/hosts/darwin/cap/nfs.rb +11 -0
- data/plugins/hosts/darwin/plugin.rb +5 -0
- data/plugins/hosts/linux/cap/nfs.rb +21 -2
- data/plugins/kernel_v2/config/disk.rb +199 -0
- data/plugins/kernel_v2/config/ssh_connect.rb +24 -0
- data/plugins/kernel_v2/config/vm.rb +109 -4
- data/plugins/kernel_v2/config/vm_provisioner.rb +4 -1
- data/plugins/kernel_v2/config/vm_trigger.rb +2 -5
- data/plugins/providers/docker/driver.rb +38 -10
- data/plugins/providers/docker/errors.rb +4 -0
- data/plugins/providers/docker/executor/local.rb +7 -1
- data/plugins/providers/hyperv/action/export.rb +4 -2
- data/plugins/providers/hyperv/driver.rb +10 -9
- data/plugins/providers/hyperv/scripts/set_vm_integration_services.ps1 +3 -3
- data/plugins/providers/hyperv/scripts/utils/VagrantVM/VagrantVM.psm1 +6 -6
- data/plugins/providers/virtualbox/action.rb +2 -0
- 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/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 +54 -0
- data/plugins/providers/virtualbox/cap/configure_disks.rb +287 -0
- data/plugins/providers/virtualbox/cap/validate_disk_ext.rb +27 -0
- data/plugins/providers/virtualbox/driver/base.rb +15 -0
- data/plugins/providers/virtualbox/driver/meta.rb +14 -2
- data/plugins/providers/virtualbox/driver/version_5_0.rb +142 -2
- data/plugins/providers/virtualbox/driver/version_6_1.rb +39 -0
- data/plugins/providers/virtualbox/plugin.rb +21 -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 +54 -25
- data/plugins/synced_folders/smb/synced_folder.rb +1 -1
- data/templates/commands/init/Vagrantfile.erb +1 -1
- data/templates/locales/en.yml +123 -4
- data/templates/locales/providers_docker.yml +2 -0
- data/templates/nfs/exports_darwin.erb +7 -0
- data/vagrant.gemspec +8 -9
- data/version.txt +1 -1
- metadata +3731 -3663
- 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
@@ -0,0 +1,27 @@
|
|
1
|
+
require "log4r"
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module ProviderVirtualBox
|
5
|
+
module Cap
|
6
|
+
module ValidateDiskExt
|
7
|
+
LOGGER = Log4r::Logger.new("vagrant::plugins::virtualbox::validate_disk_ext")
|
8
|
+
|
9
|
+
# The default set of disk formats that VirtualBox supports
|
10
|
+
DEFAULT_DISK_EXT = ["vdi", "vmdk", "vhd"].map(&:freeze).freeze
|
11
|
+
|
12
|
+
# @param [Vagrant::Machine] machine
|
13
|
+
# @param [String] disk_ext
|
14
|
+
# @return [Bool]
|
15
|
+
def self.validate_disk_ext(machine, disk_ext)
|
16
|
+
DEFAULT_DISK_EXT.include?(disk_ext)
|
17
|
+
end
|
18
|
+
|
19
|
+
# @param [Vagrant::Machine] machine
|
20
|
+
# @return [Array]
|
21
|
+
def self.get_default_disk_ext(machine)
|
22
|
+
DEFAULT_DISK_EXT
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -368,6 +368,21 @@ module VagrantPlugins
|
|
368
368
|
def vm_exists?(uuid)
|
369
369
|
end
|
370
370
|
|
371
|
+
# Returns a hash of information about a given virtual machine
|
372
|
+
#
|
373
|
+
# @param [String] uuid
|
374
|
+
# @return [Hash] info
|
375
|
+
def show_vm_info
|
376
|
+
info = {}
|
377
|
+
execute('showvminfo', @uuid, '--machinereadable', retryable: true).split("\n").each do |line|
|
378
|
+
parts = line.partition('=')
|
379
|
+
key = parts.first.gsub('"', '')
|
380
|
+
value = parts.last.gsub('"', '')
|
381
|
+
info[key] = value
|
382
|
+
end
|
383
|
+
info
|
384
|
+
end
|
385
|
+
|
371
386
|
# Execute the given subcommand for VBoxManage and return the output.
|
372
387
|
def execute(*command, &block)
|
373
388
|
# Get the options hash if it exists
|
@@ -64,6 +64,7 @@ module VagrantPlugins
|
|
64
64
|
"5.1" => Version_5_1,
|
65
65
|
"5.2" => Version_5_2,
|
66
66
|
"6.0" => Version_6_0,
|
67
|
+
"6.1" => Version_6_1,
|
67
68
|
}
|
68
69
|
|
69
70
|
if @@version.start_with?("4.2.14")
|
@@ -96,10 +97,15 @@ module VagrantPlugins
|
|
96
97
|
end
|
97
98
|
end
|
98
99
|
|
99
|
-
def_delegators :@driver,
|
100
|
+
def_delegators :@driver,
|
101
|
+
:attach_disk,
|
102
|
+
:clear_forwarded_ports,
|
100
103
|
:clear_shared_folders,
|
104
|
+
:clone_disk,
|
101
105
|
:clonevm,
|
106
|
+
:close_medium,
|
102
107
|
:create_dhcp_server,
|
108
|
+
:create_disk,
|
103
109
|
:create_host_only_network,
|
104
110
|
:create_snapshot,
|
105
111
|
:delete,
|
@@ -110,9 +116,11 @@ module VagrantPlugins
|
|
110
116
|
:execute_command,
|
111
117
|
:export,
|
112
118
|
:forward_ports,
|
119
|
+
:get_port_and_device,
|
113
120
|
:halt,
|
114
121
|
:import,
|
115
122
|
:list_snapshots,
|
123
|
+
:list_hdds,
|
116
124
|
:read_forwarded_ports,
|
117
125
|
:read_bridged_interfaces,
|
118
126
|
:read_dhcp_servers,
|
@@ -129,6 +137,8 @@ module VagrantPlugins
|
|
129
137
|
:read_vms,
|
130
138
|
:reconfig_host_only,
|
131
139
|
:remove_dhcp_server,
|
140
|
+
:remove_disk,
|
141
|
+
:resize_disk,
|
132
142
|
:restore_snapshot,
|
133
143
|
:resume,
|
134
144
|
:set_mac_address,
|
@@ -137,9 +147,11 @@ module VagrantPlugins
|
|
137
147
|
:ssh_port,
|
138
148
|
:start,
|
139
149
|
:suspend,
|
150
|
+
:vdi_to_vmdk,
|
140
151
|
:verify!,
|
141
152
|
:verify_image,
|
142
|
-
:vm_exists
|
153
|
+
:vm_exists?,
|
154
|
+
:vmdk_to_vdi
|
143
155
|
|
144
156
|
protected
|
145
157
|
|
@@ -16,6 +16,28 @@ module VagrantPlugins
|
|
16
16
|
@uuid = uuid
|
17
17
|
end
|
18
18
|
|
19
|
+
# Controller-Port-Device looks like:
|
20
|
+
# SATA Controller-ImageUUID-0-0 (sub out ImageUUID)
|
21
|
+
# - Controller: SATA Controller
|
22
|
+
# - Port: 0
|
23
|
+
# - Device: 0
|
24
|
+
#
|
25
|
+
# @param [String] port - port on device to attach disk to
|
26
|
+
# @param [String] device - device on controller for disk
|
27
|
+
# @param [String] file - disk file path
|
28
|
+
# @param [String] type - type of disk to attach
|
29
|
+
# @param [Hash] opts - additional options
|
30
|
+
def attach_disk(port, device, file, type="hdd", **opts)
|
31
|
+
# Maybe only support SATA Controller for `:disk`???
|
32
|
+
controller = "SATA Controller"
|
33
|
+
|
34
|
+
comment = "This disk is managed externally by Vagrant. Removing or adjusting settings could potentially cause issues with Vagrant."
|
35
|
+
|
36
|
+
execute('storageattach', @uuid, '--storagectl', controller, '--port',
|
37
|
+
port.to_s, '--device', device.to_s, '--type', type, '--medium',
|
38
|
+
file, '--comment', comment)
|
39
|
+
end
|
40
|
+
|
19
41
|
def clear_forwarded_ports
|
20
42
|
retryable(on: Vagrant::Errors::VBoxManageError, tries: 3, sleep: 1) do
|
21
43
|
args = []
|
@@ -38,6 +60,13 @@ module VagrantPlugins
|
|
38
60
|
end
|
39
61
|
end
|
40
62
|
|
63
|
+
# @param [String] source
|
64
|
+
# @param [String] destination
|
65
|
+
# @param [String] disk_format
|
66
|
+
def clone_disk(source, destination, disk_format, **opts)
|
67
|
+
execute("clonemedium", source, destination, '--format', disk_format)
|
68
|
+
end
|
69
|
+
|
41
70
|
def clonevm(master_id, snapshot_name)
|
42
71
|
machine_name = "temp_clone_#{(Time.now.to_f * 1000.0).to_i}_#{rand(100000)}"
|
43
72
|
args = ["--register", "--name", machine_name]
|
@@ -49,6 +78,14 @@ module VagrantPlugins
|
|
49
78
|
return get_machine_id(machine_name)
|
50
79
|
end
|
51
80
|
|
81
|
+
# Removes a disk from the given virtual machine
|
82
|
+
#
|
83
|
+
# @param [String] disk_uuid or file path
|
84
|
+
# @param [Hash] opts - additional options
|
85
|
+
def close_medium(disk_uuid)
|
86
|
+
execute("closemedium", disk_uuid, '--delete')
|
87
|
+
end
|
88
|
+
|
52
89
|
def create_dhcp_server(network, options)
|
53
90
|
retryable(on: Vagrant::Errors::VBoxManageError, tries: 3, sleep: 1) do
|
54
91
|
begin
|
@@ -65,6 +102,17 @@ module VagrantPlugins
|
|
65
102
|
end
|
66
103
|
end
|
67
104
|
|
105
|
+
# Creates a disk. Default format is VDI unless overridden
|
106
|
+
#
|
107
|
+
# @param [String] disk_file
|
108
|
+
# @param [Integer] disk_size - size in bytes
|
109
|
+
# @param [String] disk_format - format of disk, defaults to "VDI"
|
110
|
+
# @param [Hash] opts - additional options
|
111
|
+
def create_disk(disk_file, disk_size, disk_format="VDI", **opts)
|
112
|
+
execute("createmedium", '--filename', disk_file, '--sizebyte', disk_size.to_i.to_s, '--format', disk_format)
|
113
|
+
end
|
114
|
+
|
115
|
+
|
68
116
|
def create_host_only_network(options)
|
69
117
|
# Create the interface
|
70
118
|
execute("hostonlyif", "create", retryable: true) =~ /^Interface '(.+?)' was successfully created$/
|
@@ -130,6 +178,33 @@ module VagrantPlugins
|
|
130
178
|
end
|
131
179
|
end
|
132
180
|
|
181
|
+
# Lists all attached harddisks from a given virtual machine. Additionally,
|
182
|
+
# this method adds a new key "Disk Name" based on the disks file path from "Location"
|
183
|
+
#
|
184
|
+
# @return [Array] hdds An array of hashes of harddrive info for a guest
|
185
|
+
def list_hdds
|
186
|
+
hdds = []
|
187
|
+
tmp_drive = {}
|
188
|
+
execute('list', 'hdds', retryable: true).split("\n").each do |line|
|
189
|
+
if line == "" # separator between disks
|
190
|
+
hdds << tmp_drive
|
191
|
+
tmp_drive = {}
|
192
|
+
next
|
193
|
+
end
|
194
|
+
parts = line.partition(":")
|
195
|
+
key = parts.first.strip
|
196
|
+
value = parts.last.strip
|
197
|
+
tmp_drive[key] = value
|
198
|
+
|
199
|
+
if key == "Location"
|
200
|
+
tmp_drive["Disk Name"] = File.basename(value, ".*")
|
201
|
+
end
|
202
|
+
end
|
203
|
+
hdds << tmp_drive unless tmp_drive.empty?
|
204
|
+
|
205
|
+
hdds
|
206
|
+
end
|
207
|
+
|
133
208
|
def list_snapshots(machine_id)
|
134
209
|
output = execute(
|
135
210
|
"snapshot", machine_id, "list", "--machinereadable",
|
@@ -149,6 +224,21 @@ module VagrantPlugins
|
|
149
224
|
raise
|
150
225
|
end
|
151
226
|
|
227
|
+
# @param [String] port - port on device to attach disk to
|
228
|
+
# @param [String] device - device on controller for disk
|
229
|
+
# @param [Hash] opts - additional options
|
230
|
+
def remove_disk(port, device)
|
231
|
+
controller = "SATA Controller"
|
232
|
+
execute('storageattach', @uuid, '--storagectl', controller, '--port', port.to_s, '--device', device.to_s, '--medium', "none")
|
233
|
+
end
|
234
|
+
|
235
|
+
# @param [String] disk_file
|
236
|
+
# @param [Integer] disk_size in bytes
|
237
|
+
# @param [Hash] opts - additional options
|
238
|
+
def resize_disk(disk_file, disk_size, **opts)
|
239
|
+
execute("modifymedium", disk_file, '--resizebyte', disk_size.to_i.to_s)
|
240
|
+
end
|
241
|
+
|
152
242
|
def restore_snapshot(machine_id, snapshot_name)
|
153
243
|
# Start with 0%
|
154
244
|
last = 0
|
@@ -295,6 +385,27 @@ module VagrantPlugins
|
|
295
385
|
nil
|
296
386
|
end
|
297
387
|
|
388
|
+
# Returns port and device for an attached disk given a disk uuid. Returns
|
389
|
+
# empty hash if disk is not attachd to guest
|
390
|
+
#
|
391
|
+
# @param [Hash] vm_info - A guests information from vboxmanage
|
392
|
+
# @param [String] disk_uuid - the UUID for the disk we are searching for
|
393
|
+
# @return [Hash] disk_info - Contains a device and port number
|
394
|
+
def get_port_and_device(disk_uuid)
|
395
|
+
vm_info = show_vm_info
|
396
|
+
|
397
|
+
disk = {}
|
398
|
+
disk_info_key = vm_info.key(disk_uuid)
|
399
|
+
return disk if !disk_info_key
|
400
|
+
|
401
|
+
disk_info = disk_info_key.split("-")
|
402
|
+
|
403
|
+
disk[:port] = disk_info[2]
|
404
|
+
disk[:device] = disk_info[3]
|
405
|
+
|
406
|
+
return disk
|
407
|
+
end
|
408
|
+
|
298
409
|
def halt
|
299
410
|
execute("controlvm", @uuid, "poweroff", retryable: true)
|
300
411
|
end
|
@@ -370,7 +481,7 @@ module VagrantPlugins
|
|
370
481
|
end
|
371
482
|
end
|
372
483
|
|
373
|
-
return get_machine_id
|
484
|
+
return get_machine_id(specified_name)
|
374
485
|
end
|
375
486
|
|
376
487
|
def max_network_adapters
|
@@ -476,6 +587,11 @@ module VagrantPlugins
|
|
476
587
|
|
477
588
|
def read_guest_ip(adapter_number)
|
478
589
|
ip = read_guest_property("/VirtualBox/GuestInfo/Net/#{adapter_number}/V4/IP")
|
590
|
+
if ip.end_with?(".1")
|
591
|
+
@logger.warn("VBoxManage guest property returned: #{ip}. Result resembles IP of DHCP server and is being ignored.")
|
592
|
+
ip = nil
|
593
|
+
end
|
594
|
+
|
479
595
|
if !valid_ip_address?(ip)
|
480
596
|
raise Vagrant::Errors::VirtualBoxGuestPropertyNotFound,
|
481
597
|
guest_property: "/VirtualBox/GuestInfo/Net/#{adapter_number}/V4/IP"
|
@@ -783,12 +899,36 @@ module VagrantPlugins
|
|
783
899
|
return true
|
784
900
|
end
|
785
901
|
|
902
|
+
# @param [VagrantPlugins::VirtualboxProvider::Driver] driver
|
903
|
+
# @param [String] defined_disk_path
|
904
|
+
# @return [String] destination - The cloned disk
|
905
|
+
def vmdk_to_vdi(defined_disk_path)
|
906
|
+
source = defined_disk_path
|
907
|
+
destination = File.join(File.dirname(source), File.basename(source, ".*")) + ".vdi"
|
908
|
+
|
909
|
+
clone_disk(source, destination, 'VDI')
|
910
|
+
|
911
|
+
destination
|
912
|
+
end
|
913
|
+
|
914
|
+
# @param [VagrantPlugins::VirtualboxProvider::Driver] driver
|
915
|
+
# @param [String] defined_disk_path
|
916
|
+
# @return [String] destination - The cloned disk
|
917
|
+
def vdi_to_vmdk(defined_disk_path)
|
918
|
+
source = defined_disk_path
|
919
|
+
destination = File.join(File.dirname(source), File.basename(source, ".*")) + ".vmdk"
|
920
|
+
|
921
|
+
clone_disk(source, destination, 'VMDK')
|
922
|
+
|
923
|
+
destination
|
924
|
+
end
|
925
|
+
|
786
926
|
protected
|
787
927
|
|
788
928
|
def valid_ip_address?(ip)
|
789
929
|
# Filter out invalid IP addresses
|
790
930
|
# GH-4658 VirtualBox can report an IP address of 0.0.0.0 for FreeBSD guests.
|
791
|
-
if ip == "0.0.0.0"
|
931
|
+
if ip == "0.0.0.0" || ip.nil?
|
792
932
|
return false
|
793
933
|
else
|
794
934
|
return true
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require File.expand_path("../version_6_0", __FILE__)
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module ProviderVirtualBox
|
5
|
+
module Driver
|
6
|
+
# Driver for VirtualBox 6.1.x
|
7
|
+
class Version_6_1 < Version_6_0
|
8
|
+
def initialize(uuid)
|
9
|
+
super
|
10
|
+
|
11
|
+
@logger = Log4r::Logger.new("vagrant::provider::virtualbox_6_1")
|
12
|
+
end
|
13
|
+
|
14
|
+
def read_dhcp_servers
|
15
|
+
execute("list", "dhcpservers", retryable: true).split("\n\n").collect do |block|
|
16
|
+
info = {}
|
17
|
+
|
18
|
+
block.split("\n").each do |line|
|
19
|
+
if network = line[/^NetworkName:\s+HostInterfaceNetworking-(.+?)$/, 1]
|
20
|
+
info[:network] = network
|
21
|
+
info[:network_name] = "HostInterfaceNetworking-#{network}"
|
22
|
+
elsif ip = line[/^Dhcpd IP:\s+(.+?)$/, 1]
|
23
|
+
info[:ip] = ip
|
24
|
+
elsif netmask = line[/^NetworkMask:\s+(.+?)$/, 1]
|
25
|
+
info[:netmask] = netmask
|
26
|
+
elsif lower = line[/^LowerIPAddress:\s+(.+?)$/, 1]
|
27
|
+
info[:lower] = lower
|
28
|
+
elsif upper = line[/^UpperIPAddress:\s+(.+?)$/, 1]
|
29
|
+
info[:upper] = upper
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
info
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -39,6 +39,26 @@ module VagrantPlugins
|
|
39
39
|
Cap::PublicAddress
|
40
40
|
end
|
41
41
|
|
42
|
+
provider_capability(:virtualbox, :configure_disks) do
|
43
|
+
require_relative "cap/configure_disks"
|
44
|
+
Cap::ConfigureDisks
|
45
|
+
end
|
46
|
+
|
47
|
+
provider_capability(:virtualbox, :cleanup_disks) do
|
48
|
+
require_relative "cap/cleanup_disks"
|
49
|
+
Cap::CleanupDisks
|
50
|
+
end
|
51
|
+
|
52
|
+
provider_capability(:virtualbox, :validate_disk_ext) do
|
53
|
+
require_relative "cap/validate_disk_ext"
|
54
|
+
Cap::ValidateDiskExt
|
55
|
+
end
|
56
|
+
|
57
|
+
provider_capability(:virtualbox, :get_default_disk_ext) do
|
58
|
+
require_relative "cap/validate_disk_ext"
|
59
|
+
Cap::ValidateDiskExt
|
60
|
+
end
|
61
|
+
|
42
62
|
provider_capability(:virtualbox, :snapshot_list) do
|
43
63
|
require_relative "cap"
|
44
64
|
Cap
|
@@ -59,6 +79,7 @@ module VagrantPlugins
|
|
59
79
|
autoload :Version_5_1, File.expand_path("../driver/version_5_1", __FILE__)
|
60
80
|
autoload :Version_5_2, File.expand_path("../driver/version_5_2", __FILE__)
|
61
81
|
autoload :Version_6_0, File.expand_path("../driver/version_6_0", __FILE__)
|
82
|
+
autoload :Version_6_1, File.expand_path("../driver/version_6_1", __FILE__)
|
62
83
|
end
|
63
84
|
|
64
85
|
module Model
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require_relative "../facts"
|
2
|
+
require_relative "../pip/pip"
|
3
|
+
|
4
|
+
module VagrantPlugins
|
5
|
+
module Ansible
|
6
|
+
module Cap
|
7
|
+
module Guest
|
8
|
+
module Alpine
|
9
|
+
module AnsibleInstall
|
10
|
+
|
11
|
+
def self.ansible_install(machine, install_mode, ansible_version, pip_args, pip_install_cmd = "")
|
12
|
+
case install_mode
|
13
|
+
when :pip
|
14
|
+
pip_setup machine, pip_install_cmd
|
15
|
+
Pip::pip_install machine, "ansible", ansible_version, pip_args, true
|
16
|
+
when :pip_args_only
|
17
|
+
pip_setup machine, pip_install_cmd
|
18
|
+
Pip::pip_install machine, "", "", pip_args, false
|
19
|
+
else
|
20
|
+
ansible_apk_install machine
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def self.ansible_apk_install(machine)
|
27
|
+
machine.communicate.sudo "apk add --update --no-cache python3 ansible"
|
28
|
+
machine.communicate.sudo "if [ ! -e /usr/bin/python ]; then ln -sf python3 /usr/bin/python ; fi"
|
29
|
+
machine.communicate.sudo "if [ ! -e /usr/bin/pip ]; then ln -sf pip3 /usr/bin/pip ; fi"
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.pip_setup(machine, pip_install_cmd = "")
|
33
|
+
machine.communicate.sudo "apk add --update --no-cache python3"
|
34
|
+
machine.communicate.sudo "if [ ! -e /usr/bin/python ]; then ln -sf python3 /usr/bin/python ; fi"
|
35
|
+
machine.communicate.sudo "apk add --update --no-cache --virtual .build-deps python3-dev libffi-dev openssl-dev build-base"
|
36
|
+
Pip::get_pip machine, pip_install_cmd
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative "../../../errors"
|
2
|
+
require_relative "../pip/pip"
|
2
3
|
|
3
4
|
module VagrantPlugins
|
4
5
|
module Ansible
|
@@ -7,15 +8,31 @@ module VagrantPlugins
|
|
7
8
|
module Arch
|
8
9
|
module AnsibleInstall
|
9
10
|
|
10
|
-
def self.ansible_install(machine, install_mode, ansible_version, pip_args)
|
11
|
-
|
12
|
-
|
11
|
+
def self.ansible_install(machine, install_mode, ansible_version, pip_args, pip_install_cmd = "")
|
12
|
+
case install_mode
|
13
|
+
when :pip
|
14
|
+
pip_setup machine, pip_install_cmd
|
15
|
+
Pip::pip_install machine, "ansible", ansible_version, pip_args, true
|
16
|
+
|
17
|
+
when :pip_args_only
|
18
|
+
pip_setup machine, pip_install_cmd
|
19
|
+
Pip::pip_install machine, "", "", pip_args, false
|
20
|
+
|
13
21
|
else
|
14
22
|
machine.communicate.sudo "pacman -Syy --noconfirm"
|
15
23
|
machine.communicate.sudo "pacman -S --noconfirm ansible"
|
16
24
|
end
|
17
25
|
end
|
18
26
|
|
27
|
+
private
|
28
|
+
|
29
|
+
def self.pip_setup(machine, pip_install_cmd = "")
|
30
|
+
machine.communicate.sudo "pacman -Syy --noconfirm"
|
31
|
+
machine.communicate.sudo "pacman -S --noconfirm base-devel curl git python"
|
32
|
+
|
33
|
+
Pip::get_pip machine, pip_install_cmd
|
34
|
+
end
|
35
|
+
|
19
36
|
end
|
20
37
|
end
|
21
38
|
end
|