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
@@ -1,9 +1,12 @@
|
|
1
1
|
module VagrantPlugins
|
2
2
|
module Kernel_V2
|
3
3
|
class SSHConnectConfig < Vagrant.plugin("2", :config)
|
4
|
+
DEFAULT_SSH_CONNECT_TIMEOUT = 15
|
5
|
+
|
4
6
|
attr_accessor :host
|
5
7
|
attr_accessor :port
|
6
8
|
attr_accessor :config
|
9
|
+
attr_accessor :connect_timeout
|
7
10
|
attr_accessor :private_key_path
|
8
11
|
attr_accessor :username
|
9
12
|
attr_accessor :password
|
@@ -20,6 +23,7 @@ module VagrantPlugins
|
|
20
23
|
@host = UNSET_VALUE
|
21
24
|
@port = UNSET_VALUE
|
22
25
|
@config = UNSET_VALUE
|
26
|
+
@connect_timeout = UNSET_VALUE
|
23
27
|
@private_key_path = UNSET_VALUE
|
24
28
|
@username = UNSET_VALUE
|
25
29
|
@password = UNSET_VALUE
|
@@ -47,6 +51,7 @@ module VagrantPlugins
|
|
47
51
|
@dsa_authentication = true if @dsa_authentication == UNSET_VALUE
|
48
52
|
@extra_args = nil if @extra_args == UNSET_VALUE
|
49
53
|
@config = nil if @config == UNSET_VALUE
|
54
|
+
@connect_timeout = DEFAULT_SSH_CONNECT_TIMEOUT if @connect_timeout == UNSET_VALUE
|
50
55
|
|
51
56
|
if @private_key_path && !@private_key_path.is_a?(Array)
|
52
57
|
@private_key_path = [@private_key_path]
|
@@ -76,6 +81,15 @@ module VagrantPlugins
|
|
76
81
|
when :secure
|
77
82
|
@verify_host_key = :always
|
78
83
|
end
|
84
|
+
|
85
|
+
# Attempt to convert timeout to integer value
|
86
|
+
# If we can't convert the connect timeout into an integer or
|
87
|
+
# if the value is less than 1, set it to the default value
|
88
|
+
begin
|
89
|
+
@connect_timeout = @connect_timeout.to_i
|
90
|
+
rescue
|
91
|
+
# ignore
|
92
|
+
end
|
79
93
|
end
|
80
94
|
|
81
95
|
# NOTE: This is _not_ a valid config validation method, since it
|
@@ -110,6 +124,16 @@ module VagrantPlugins
|
|
110
124
|
machine.env.ui.warn(I18n.t("vagrant.config.ssh.paranoid_deprecated"))
|
111
125
|
end
|
112
126
|
|
127
|
+
if !@connect_timeout.is_a?(Integer)
|
128
|
+
errors << I18n.t(
|
129
|
+
"vagrant.config.ssh.connect_timeout_invalid_type",
|
130
|
+
given: @connect_timeout.class.name)
|
131
|
+
elsif @connect_timeout < 1
|
132
|
+
errors << I18n.t(
|
133
|
+
"vagrant.config.ssh.connect_timeout_invalid_value",
|
134
|
+
given: @connect_timeout.to_s)
|
135
|
+
end
|
136
|
+
|
113
137
|
errors
|
114
138
|
end
|
115
139
|
end
|
@@ -11,6 +11,7 @@ require "vagrant/util/experimental"
|
|
11
11
|
|
12
12
|
require File.expand_path("../vm_provisioner", __FILE__)
|
13
13
|
require File.expand_path("../vm_subvm", __FILE__)
|
14
|
+
require File.expand_path("../disk", __FILE__)
|
14
15
|
|
15
16
|
module VagrantPlugins
|
16
17
|
module Kernel_V2
|
@@ -36,6 +37,7 @@ module VagrantPlugins
|
|
36
37
|
attr_accessor :box_download_client_cert
|
37
38
|
attr_accessor :box_download_insecure
|
38
39
|
attr_accessor :box_download_location_trusted
|
40
|
+
attr_accessor :box_download_options
|
39
41
|
attr_accessor :communicator
|
40
42
|
attr_accessor :graceful_halt_timeout
|
41
43
|
attr_accessor :guest
|
@@ -43,6 +45,8 @@ module VagrantPlugins
|
|
43
45
|
attr_accessor :post_up_message
|
44
46
|
attr_accessor :usable_port_range
|
45
47
|
attr_reader :provisioners
|
48
|
+
attr_reader :disks
|
49
|
+
attr_reader :box_extra_download_options
|
46
50
|
|
47
51
|
# This is an experimental feature that isn't public yet.
|
48
52
|
attr_accessor :clone
|
@@ -64,6 +68,8 @@ module VagrantPlugins
|
|
64
68
|
@box_download_client_cert = UNSET_VALUE
|
65
69
|
@box_download_insecure = UNSET_VALUE
|
66
70
|
@box_download_location_trusted = UNSET_VALUE
|
71
|
+
@box_download_options = UNSET_VALUE
|
72
|
+
@box_extra_download_options = UNSET_VALUE
|
67
73
|
@box_url = UNSET_VALUE
|
68
74
|
@box_version = UNSET_VALUE
|
69
75
|
@clone = UNSET_VALUE
|
@@ -73,6 +79,7 @@ module VagrantPlugins
|
|
73
79
|
@hostname = UNSET_VALUE
|
74
80
|
@post_up_message = UNSET_VALUE
|
75
81
|
@provisioners = []
|
82
|
+
@disks = []
|
76
83
|
@usable_port_range = UNSET_VALUE
|
77
84
|
|
78
85
|
# Internal state
|
@@ -123,6 +130,28 @@ module VagrantPlugins
|
|
123
130
|
end
|
124
131
|
end
|
125
132
|
|
133
|
+
# Merge defined disks
|
134
|
+
other_disks = other.instance_variable_get(:@disks)
|
135
|
+
new_disks = []
|
136
|
+
@disks.each do |p|
|
137
|
+
other_p = other_disks.find { |o| p.id == o.id }
|
138
|
+
if other_p
|
139
|
+
# there is an override. take it.
|
140
|
+
other_p.config = p.config.merge(other_p.config)
|
141
|
+
|
142
|
+
# Remove duplicate disk config from other
|
143
|
+
p = other_p
|
144
|
+
other_disks.delete(other_p)
|
145
|
+
end
|
146
|
+
|
147
|
+
# there is an override, merge it into the
|
148
|
+
new_disks << p.dup
|
149
|
+
end
|
150
|
+
other_disks.each do |p|
|
151
|
+
new_disks << p.dup
|
152
|
+
end
|
153
|
+
result.instance_variable_set(:@disks, new_disks)
|
154
|
+
|
126
155
|
# Merge the providers by prepending any configuration blocks we
|
127
156
|
# have for providers onto the new configuration.
|
128
157
|
other_providers = other.instance_variable_get(:@__providers)
|
@@ -384,6 +413,38 @@ module VagrantPlugins
|
|
384
413
|
@__defined_vms[name].config_procs << [options[:config_version], block] if block
|
385
414
|
end
|
386
415
|
|
416
|
+
# Stores disk config options from Vagrantfile
|
417
|
+
#
|
418
|
+
# @param [Symbol] type
|
419
|
+
# @param [Hash] options
|
420
|
+
# @param [Block] block
|
421
|
+
def disk(type, **options, &block)
|
422
|
+
disk_config = VagrantConfigDisk.new(type)
|
423
|
+
|
424
|
+
# Remove provider__option options before set_options, otherwise will
|
425
|
+
# show up as missing setting
|
426
|
+
# Extract provider hash options as well
|
427
|
+
provider_options = {}
|
428
|
+
options.delete_if do |p,o|
|
429
|
+
if o.is_a?(Hash) || p.to_s.include?("__")
|
430
|
+
provider_options[p] = o
|
431
|
+
true
|
432
|
+
end
|
433
|
+
end
|
434
|
+
|
435
|
+
disk_config.set_options(options)
|
436
|
+
|
437
|
+
# Add provider config
|
438
|
+
disk_config.add_provider_config(provider_options, &block)
|
439
|
+
|
440
|
+
if !Vagrant::Util::Experimental.feature_enabled?("disks")
|
441
|
+
@logger.warn("Disk config defined, but experimental feature is not enabled. To use this feature, enable it with the experimental flag `disks`. Disk will not be added to internal config, and will be ignored.")
|
442
|
+
return
|
443
|
+
end
|
444
|
+
|
445
|
+
@disks << disk_config
|
446
|
+
end
|
447
|
+
|
387
448
|
#-------------------------------------------------------------------
|
388
449
|
# Internal methods, don't call these.
|
389
450
|
#-------------------------------------------------------------------
|
@@ -410,6 +471,8 @@ module VagrantPlugins
|
|
410
471
|
@box_download_location_trusted = false if @box_download_location_trusted == UNSET_VALUE
|
411
472
|
@box_url = nil if @box_url == UNSET_VALUE
|
412
473
|
@box_version = nil if @box_version == UNSET_VALUE
|
474
|
+
@box_download_options = {} if @box_download_options == UNSET_VALUE
|
475
|
+
@box_extra_download_options = Vagrant::Util::MapCommandOptions.map_to_command_options(@box_download_options)
|
413
476
|
@clone = nil if @clone == UNSET_VALUE
|
414
477
|
@communicator = nil if @communicator == UNSET_VALUE
|
415
478
|
@graceful_halt_timeout = 60 if @graceful_halt_timeout == UNSET_VALUE
|
@@ -547,6 +610,10 @@ module VagrantPlugins
|
|
547
610
|
end
|
548
611
|
end
|
549
612
|
|
613
|
+
@disks.each do |d|
|
614
|
+
d.finalize!
|
615
|
+
end
|
616
|
+
|
550
617
|
if !current_dir_shared && !@__synced_folders["/vagrant"]
|
551
618
|
synced_folder(".", "/vagrant")
|
552
619
|
end
|
@@ -609,7 +676,7 @@ module VagrantPlugins
|
|
609
676
|
errors << I18n.t("vagrant.config.vm.clone_and_box")
|
610
677
|
end
|
611
678
|
|
612
|
-
errors << I18n.t("vagrant.config.vm.hostname_invalid_characters") if \
|
679
|
+
errors << I18n.t("vagrant.config.vm.hostname_invalid_characters", name: machine.name) if \
|
613
680
|
@hostname && @hostname !~ /^[a-z0-9][-.a-z0-9]*$/i
|
614
681
|
|
615
682
|
if @box_version
|
@@ -653,6 +720,19 @@ module VagrantPlugins
|
|
653
720
|
end
|
654
721
|
end
|
655
722
|
|
723
|
+
if !box_download_options.is_a?(Hash)
|
724
|
+
errors << I18n.t("vagrant.config.vm.box_download_options_type", type: box_download_options.class.to_s)
|
725
|
+
end
|
726
|
+
|
727
|
+
box_download_options.each do |k, v|
|
728
|
+
# If the value is truthy and
|
729
|
+
# if `box_extra_download_options` does not include the key
|
730
|
+
# then the conversion to extra download options produced an error
|
731
|
+
if v && !box_extra_download_options.include?("--#{k}")
|
732
|
+
errors << I18n.t("vagrant.config.vm.box_download_options_not_converted", missing_key: k)
|
733
|
+
end
|
734
|
+
end
|
735
|
+
|
656
736
|
used_guest_paths = Set.new
|
657
737
|
@__synced_folders.each do |id, options|
|
658
738
|
# If the shared folder is disabled then don't worry about validating it
|
@@ -694,9 +774,14 @@ module VagrantPlugins
|
|
694
774
|
errors << I18n.t("vagrant.config.vm.shared_folder_mount_options_array")
|
695
775
|
end
|
696
776
|
|
697
|
-
|
698
|
-
|
699
|
-
|
777
|
+
if options[:type]
|
778
|
+
plugins = Vagrant.plugin("2").manager.synced_folders
|
779
|
+
impl_class = plugins[options[:type]]
|
780
|
+
if !impl_class
|
781
|
+
errors << I18n.t("vagrant.config.vm.shared_folder_invalid_option_type",
|
782
|
+
type: options[:type],
|
783
|
+
options: plugins.keys.join(', '))
|
784
|
+
end
|
700
785
|
end
|
701
786
|
end
|
702
787
|
|
@@ -748,6 +833,26 @@ module VagrantPlugins
|
|
748
833
|
end
|
749
834
|
end
|
750
835
|
|
836
|
+
# Validate disks
|
837
|
+
# Check if there is more than one primrary disk defined and throw an error
|
838
|
+
primary_disks = @disks.select { |d| d.primary && d.type == :disk }
|
839
|
+
if primary_disks.size > 1
|
840
|
+
errors << I18n.t("vagrant.config.vm.multiple_primary_disks_error",
|
841
|
+
name: machine.name)
|
842
|
+
end
|
843
|
+
|
844
|
+
disk_names = @disks.map { |d| d.name }
|
845
|
+
duplicate_names = disk_names.detect{ |d| disk_names.count(d) > 1 }
|
846
|
+
if duplicate_names && duplicate_names.size
|
847
|
+
errors << I18n.t("vagrant.config.vm.multiple_disk_names_error",
|
848
|
+
name: duplicate_names)
|
849
|
+
end
|
850
|
+
|
851
|
+
@disks.each do |d|
|
852
|
+
error = d.validate(machine)
|
853
|
+
errors.concat error if !error.empty?
|
854
|
+
end
|
855
|
+
|
751
856
|
# We're done with VM level errors so prepare the section
|
752
857
|
errors = { "vm" => errors }
|
753
858
|
|
@@ -9,7 +9,10 @@ module VagrantPlugins
|
|
9
9
|
|
10
10
|
# Unique name for this provisioner
|
11
11
|
#
|
12
|
-
#
|
12
|
+
# Accepts a string, but is ultimately forced into a symbol in the top level method inside
|
13
|
+
# #Config::VM.provision method while being parsed from a Vagrantfile
|
14
|
+
#
|
15
|
+
# @return [Symbol]
|
13
16
|
attr_reader :name
|
14
17
|
|
15
18
|
# Internal unique name for this provisioner
|
@@ -114,7 +114,7 @@ module VagrantPlugins
|
|
114
114
|
|
115
115
|
# Internal options
|
116
116
|
@id = SecureRandom.uuid
|
117
|
-
@command = command.
|
117
|
+
@command = command.to_s
|
118
118
|
@ruby_block = UNSET_VALUE
|
119
119
|
|
120
120
|
@logger.debug("Trigger defined for: #{command}")
|
@@ -214,10 +214,7 @@ module VagrantPlugins
|
|
214
214
|
end
|
215
215
|
|
216
216
|
if @type == :command || !@type
|
217
|
-
commands =
|
218
|
-
Vagrant.plugin("2").manager.commands.each do |key,data|
|
219
|
-
commands.push(key)
|
220
|
-
end
|
217
|
+
commands = Vagrant.plugin("2").manager.commands.keys.map(&:to_s)
|
221
218
|
|
222
219
|
if !commands.include?(@command) && @command != :all
|
223
220
|
machine.ui.warn(I18n.t("vagrant.config.triggers.bad_command_warning",
|
@@ -15,19 +15,46 @@ module VagrantPlugins
|
|
15
15
|
@executor = Executor::Local.new
|
16
16
|
end
|
17
17
|
|
18
|
+
# Returns the id for a new container built from `docker build`. Raises
|
19
|
+
# an exception if the id was unable to be captured from the output
|
20
|
+
#
|
21
|
+
# @return [String] id - ID matched from the docker build output.
|
18
22
|
def build(dir, **opts, &block)
|
19
|
-
args
|
20
|
-
args
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
args = Array(opts[:extra_args])
|
24
|
+
args << dir
|
25
|
+
opts = {with_stderr: true}
|
26
|
+
result = execute('docker', 'build', *args, opts, &block)
|
27
|
+
# Check for the new output format 'writing image sha256...'
|
28
|
+
# In this case, docker builtkit is enabled. Its format is different
|
29
|
+
# from standard docker
|
30
|
+
matches = result.scan(/writing image .+:([0-9a-z]+) done/i).last
|
31
|
+
if !matches
|
32
|
+
if podman?
|
33
|
+
# Check for podman format when it is emulating docker CLI.
|
34
|
+
# Podman outputs the full hash of the container on
|
35
|
+
# the last line after a successful build.
|
36
|
+
match = result.split.select { |str| str.match?(/[0-9a-z]{64}/) }.last
|
37
|
+
return match[0..7] unless match.nil?
|
38
|
+
else
|
39
|
+
matches = result.scan(/Successfully built (.+)$/i).last
|
40
|
+
end
|
41
|
+
|
42
|
+
if !matches
|
43
|
+
# This will cause a stack trace in Vagrant, but it is a bug
|
44
|
+
# if this happens anyways.
|
45
|
+
raise Errors::BuildError, result: result
|
46
|
+
end
|
27
47
|
end
|
28
48
|
|
29
|
-
# Return the
|
30
|
-
matches[
|
49
|
+
# Return the matched group `id`
|
50
|
+
matches[0]
|
51
|
+
end
|
52
|
+
|
53
|
+
# Check if podman emulating docker CLI is enabled.
|
54
|
+
#
|
55
|
+
# @return [Bool]
|
56
|
+
def podman?
|
57
|
+
execute('docker', '--version').include?("podman")
|
31
58
|
end
|
32
59
|
|
33
60
|
def create(params, **opts, &block)
|
@@ -154,6 +181,7 @@ module VagrantPlugins
|
|
154
181
|
return true
|
155
182
|
rescue => e
|
156
183
|
return false if e.to_s.include?("is using it")
|
184
|
+
return false if e.to_s.include?("is being used")
|
157
185
|
raise if !e.to_s.include?("No such image")
|
158
186
|
end
|
159
187
|
|
@@ -25,8 +25,10 @@ module VagrantPlugins
|
|
25
25
|
@env[:ui].info I18n.t("vagrant.actions.vm.export.exporting")
|
26
26
|
export_tmp_dir = Vagrant::Util::Platform.wsl_to_windows_path(@env["export.temp_dir"])
|
27
27
|
@env[:machine].provider.driver.export(export_tmp_dir) do |progress|
|
28
|
-
@env[:ui].
|
29
|
-
|
28
|
+
@env[:ui].rewriting do |ui|
|
29
|
+
ui.clear_line
|
30
|
+
ui.report_progress(progress.percent, 100, false)
|
31
|
+
end
|
30
32
|
end
|
31
33
|
|
32
34
|
# Clear the line a final time so the next data can appear
|
@@ -10,15 +10,16 @@ module VagrantPlugins
|
|
10
10
|
ERROR_REGEXP = /===Begin-Error===(.+?)===End-Error===/m
|
11
11
|
OUTPUT_REGEXP = /===Begin-Output===(.+?)===End-Output===/m
|
12
12
|
|
13
|
-
# Name mapping for integration services for
|
13
|
+
# Name mapping for integration services for id
|
14
|
+
# https://social.technet.microsoft.com/Forums/de-DE/154917de-f3ca-4b1e-b3f8-23dd4b4f0f06/getvmintegrationservice-sprachabhngig?forum=powershell_de
|
14
15
|
INTEGRATION_SERVICES_MAP = {
|
15
|
-
guest_service_interface: "
|
16
|
-
heartbeat: "
|
17
|
-
key_value_pair_exchange: "
|
18
|
-
shutdown: "
|
19
|
-
time_synchronization: "
|
20
|
-
vss: "
|
21
|
-
}
|
16
|
+
guest_service_interface: "6C09BB55-D683-4DA0-8931-C9BF705F6480".freeze,
|
17
|
+
heartbeat: "84EAAE65-2F2E-45F5-9BB5-0E857DC8EB47".freeze,
|
18
|
+
key_value_pair_exchange: "2A34B1C2-FD73-4043-8A5B-DD2159BC743F".freeze,
|
19
|
+
shutdown: "9F8233AC-BE49-4C79-8EE3-E7E1985B2077".freeze,
|
20
|
+
time_synchronization: "2497F4DE-E9FA-4204-80E4-4B75C46419C0".freeze,
|
21
|
+
vss: "5CED1297-4598-4915-A5FC-AD21BB4D02A4".freeze,
|
22
|
+
}.freeze
|
22
23
|
|
23
24
|
# @return [String] VM ID
|
24
25
|
attr_reader :vm_id
|
@@ -203,7 +204,7 @@ module VagrantPlugins
|
|
203
204
|
# to configurable even if Vagrant is not aware of them.
|
204
205
|
def set_vm_integration_services(config)
|
205
206
|
config.each_pair do |srv_name, srv_enable|
|
206
|
-
args = {VMID: vm_id,
|
207
|
+
args = {VMID: vm_id, Id: INTEGRATION_SERVICES_MAP.fetch(srv_name.to_sym, srv_name).to_s}
|
207
208
|
args[:Enable] = true if srv_enable
|
208
209
|
execute(:set_vm_integration_services, args)
|
209
210
|
end
|
@@ -4,7 +4,7 @@ param (
|
|
4
4
|
[parameter (Mandatory=$true)]
|
5
5
|
[string] $VMID,
|
6
6
|
[parameter (Mandatory=$true)]
|
7
|
-
[string] $
|
7
|
+
[string] $Id,
|
8
8
|
[parameter (Mandatory=$false)]
|
9
9
|
[switch] $Enable
|
10
10
|
)
|
@@ -19,9 +19,9 @@ try {
|
|
19
19
|
}
|
20
20
|
|
21
21
|
try {
|
22
|
-
Set-VagrantVMService -VM $VM -
|
22
|
+
Set-VagrantVMService -VM $VM -Id $Id -Enable $Enable
|
23
23
|
} catch {
|
24
24
|
if($Enable){ $action = "enable" } else { $action = "disable" }
|
25
|
-
Write-ErrorMessage "Failed to ${action} VM integration service ${
|
25
|
+
Write-ErrorMessage "Failed to ${action} VM integration service id ${Id}: ${PSItem}"
|
26
26
|
exit 1
|
27
27
|
}
|