vagrant-unbundled 2.2.6.2 → 2.2.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.hashibot.hcl +12 -0
  3. data/CHANGELOG.md +37 -2
  4. data/contrib/bash/completion.sh +13 -1
  5. data/lib/vagrant/action.rb +1 -0
  6. data/lib/vagrant/action/builtin/box_add.rb +9 -3
  7. data/lib/vagrant/action/builtin/box_check_outdated.rb +12 -15
  8. data/lib/vagrant/action/builtin/disk.rb +39 -0
  9. data/lib/vagrant/action/builtin/mixin_provisioners.rb +19 -1
  10. data/lib/vagrant/action/builtin/ssh_run.rb +21 -3
  11. data/lib/vagrant/action/warden.rb +9 -0
  12. data/lib/vagrant/box_metadata.rb +17 -3
  13. data/lib/vagrant/errors.rb +4 -0
  14. data/lib/vagrant/ui.rb +8 -3
  15. data/lib/vagrant/util/file_checksum.rb +6 -2
  16. data/lib/vagrant/util/is_port_open.rb +1 -2
  17. data/lib/vagrant/util/numeric.rb +61 -0
  18. data/plugins/commands/box/command/outdated.rb +14 -2
  19. data/plugins/commands/cloud/publish.rb +1 -1
  20. data/plugins/commands/snapshot/command/save.rb +13 -8
  21. data/plugins/guests/alpine/cap/rsync.rb +1 -1
  22. data/plugins/guests/alpine/plugin.rb +16 -0
  23. data/plugins/guests/darwin/cap/mount_vmware_shared_folder.rb +86 -13
  24. data/plugins/guests/linux/cap/reboot.rb +42 -0
  25. data/plugins/guests/linux/plugin.rb +10 -0
  26. data/plugins/guests/redhat/cap/nfs_client.rb +2 -2
  27. data/plugins/guests/suse/cap/change_host_name.rb +2 -2
  28. data/plugins/hosts/darwin/cap/nfs.rb +11 -0
  29. data/plugins/hosts/darwin/plugin.rb +5 -0
  30. data/plugins/hosts/linux/cap/nfs.rb +20 -2
  31. data/plugins/kernel_v2/config/disk.rb +168 -0
  32. data/plugins/kernel_v2/config/vm.rb +82 -1
  33. data/plugins/kernel_v2/config/vm_provisioner.rb +4 -1
  34. data/plugins/providers/docker/driver.rb +22 -10
  35. data/plugins/providers/docker/errors.rb +4 -0
  36. data/plugins/providers/docker/executor/local.rb +7 -1
  37. data/plugins/providers/virtualbox/action.rb +1 -0
  38. data/plugins/providers/virtualbox/action/clean_machine_folder.rb +10 -1
  39. data/plugins/providers/virtualbox/driver/meta.rb +1 -0
  40. data/plugins/providers/virtualbox/driver/version_6_1.rb +16 -0
  41. data/plugins/providers/virtualbox/plugin.rb +1 -0
  42. data/plugins/provisioners/ansible/cap/guest/arch/ansible_install.rb +20 -3
  43. data/plugins/provisioners/ansible/cap/guest/debian/ansible_install.rb +4 -5
  44. data/plugins/provisioners/ansible/cap/guest/fedora/ansible_install.rb +2 -2
  45. data/plugins/provisioners/ansible/cap/guest/freebsd/ansible_install.rb +2 -2
  46. data/plugins/provisioners/ansible/cap/guest/pip/pip.rb +8 -4
  47. data/plugins/provisioners/ansible/cap/guest/redhat/ansible_install.rb +2 -2
  48. data/plugins/provisioners/ansible/cap/guest/suse/ansible_install.rb +2 -1
  49. data/plugins/provisioners/ansible/cap/guest/ubuntu/ansible_install.rb +3 -3
  50. data/templates/commands/init/Vagrantfile.erb +1 -1
  51. data/templates/locales/en.yml +32 -2
  52. data/templates/locales/providers_docker.yml +2 -0
  53. data/templates/nfs/exports_darwin.erb +7 -0
  54. data/vagrant.gemspec +3 -4
  55. data/version.txt +1 -1
  56. metadata +7273 -773
@@ -26,6 +26,10 @@ module VagrantPlugins
26
26
  options[:global] = g
27
27
  end
28
28
 
29
+ o.on("-f", "--force", "Force checks for latest box updates") do |f|
30
+ options[:force] = f
31
+ end
32
+
29
33
  build_download_options(o, download_options)
30
34
  end
31
35
 
@@ -40,7 +44,7 @@ module VagrantPlugins
40
44
 
41
45
  with_target_vms(argv) do |machine|
42
46
  @env.action_runner.run(Vagrant::Action.action_box_outdated, {
43
- box_outdated_force: true,
47
+ box_outdated_force: options[:force],
44
48
  box_outdated_refresh: true,
45
49
  box_outdated_success_ui: true,
46
50
  machine: machine,
@@ -73,7 +77,15 @@ module VagrantPlugins
73
77
  end
74
78
 
75
79
  current = Gem::Version.new(box.version)
76
- latest = Gem::Version.new(md.versions.last)
80
+ box_versions = md.versions(provider: box.provider)
81
+
82
+ if box_versions.empty?
83
+ latest_box_version = box_versions.last.to_i
84
+ else
85
+ latest_box_version = box_versions.last
86
+ end
87
+
88
+ latest = Gem::Version.new(latest_box_version)
77
89
  if latest <= current
78
90
  @env.ui.success(I18n.t(
79
91
  "vagrant.box_up_to_date",
@@ -55,7 +55,7 @@ module VagrantPlugins
55
55
  argv = parse_options(opts)
56
56
  return if !argv
57
57
 
58
- if argv.empty? || argv.length > 4 || argv.length < 3
58
+ if argv.empty? || argv.length > 4 || argv.length < 3 || (argv.length == 3 && !options[:url])
59
59
  raise Vagrant::Errors::CLIInvalidUsage,
60
60
  help: opts.help.chomp
61
61
  end
@@ -15,6 +15,9 @@ module VagrantPlugins
15
15
  o.separator "can be restored via `vagrant snapshot restore` at any point in the"
16
16
  o.separator "future to get back to this exact machine state."
17
17
  o.separator ""
18
+ o.separator "If no vm-name is given, Vagrant will take a snapshot of"
19
+ o.separator "the entire environment with the same snapshot name."
20
+ o.separator ""
18
21
  o.separator "Snapshots are useful for experimenting in a machine and being able"
19
22
  o.separator "to rollback quickly."
20
23
 
@@ -31,20 +34,22 @@ module VagrantPlugins
31
34
  help: opts.help.chomp
32
35
  end
33
36
 
34
- # If no snapshot name is given, the backup name is the same as the machine name.
35
- # If there is a name given, we need to remove it and save it as `name`. Otherwise
36
- # `with_target_vms` will treat the snapshot name as a guest name.
37
- if argv.size < 2
38
- name = argv.first
39
- else
40
- name = argv.pop
41
- end
37
+ name = argv.pop
42
38
 
43
39
  with_target_vms(argv) do |vm|
44
40
  if !vm.provider.capability?(:snapshot_list)
45
41
  raise Vagrant::Errors::SnapshotNotSupported
46
42
  end
47
43
 
44
+ # In this case, no vm name was given, and we are iterating over the
45
+ # entire environment. If a vm hasn't been created yet, we can't list
46
+ # its snapshots
47
+ if vm.id.nil?
48
+ @env.ui.warn(I18n.t("vagrant.commands.snapshot.save.vm_not_created",
49
+ name: vm.name))
50
+ next
51
+ end
52
+
48
53
  snapshot_list = vm.provider.capability(:snapshot_list)
49
54
 
50
55
  if !snapshot_list.include? name
@@ -8,7 +8,7 @@ module VagrantPlugins
8
8
 
9
9
  def self.rsync_install(machine)
10
10
  machine.communicate.tap do |comm|
11
- comm.sudo('apk add rsync')
11
+ comm.sudo('apk add --update-cache rsync')
12
12
  end
13
13
  end
14
14
  end
@@ -45,6 +45,22 @@ module VagrantPlugins
45
45
  require_relative 'cap/smb'
46
46
  Cap::SMB
47
47
  end
48
+
49
+ def self.check_community_plugin
50
+ plugins = Vagrant::Plugin::Manager.instance.installed_plugins
51
+ if plugins.keys.include?("vagrant-alpine")
52
+ $stderr.puts <<-EOF
53
+ WARNING: Vagrant has detected the `vagrant-alpine` plugin. This plugin's
54
+ functionality has been merged into the main Vagrant project and should be
55
+ considered deprecated. To uninstall the plugin, run the command shown below:
56
+
57
+ vagrant plugin uninstall vagrant-alpine
58
+
59
+ EOF
60
+ end
61
+ end
62
+
63
+ self.check_community_plugin
48
64
  end
49
65
  end
50
66
  end
@@ -1,3 +1,5 @@
1
+ require "securerandom"
2
+
1
3
  module VagrantPlugins
2
4
  module GuestDarwin
3
5
  module Cap
@@ -5,30 +7,101 @@ module VagrantPlugins
5
7
 
6
8
  # we seem to be unable to ask 'mount -t vmhgfs' to mount the roots
7
9
  # of specific shares, so instead we symlink from what is already
8
- # mounted by the guest tools
10
+ # mounted by the guest tools
9
11
  # (ie. the behaviour of the VMware_fusion provider prior to 0.8.x)
10
12
 
11
13
  def self.mount_vmware_shared_folder(machine, name, guestpath, options)
14
+ # Use this variable to determine which machines
15
+ # have been registered with after hook
16
+ @apply_firmlinks ||= Hash.new{ |h, k| h[k] = {bootstrap: false, content: []} }
17
+
12
18
  machine.communicate.tap do |comm|
13
- # clear prior symlink
14
- if comm.test("test -L \"#{guestpath}\"", sudo: true)
15
- comm.sudo("rm -f \"#{guestpath}\"")
19
+ # check if we are dealing with an APFS root container
20
+ if comm.test("test -d /System/Volumes/Data")
21
+ parts = Pathname.new(guestpath).descend.to_a
22
+ firmlink = parts[1].to_s
23
+ firmlink.slice!(0, 1) if firmlink.start_with?("/")
24
+ if parts.size > 2
25
+ guestpath = File.join("/System/Volumes/Data", guestpath)
26
+ else
27
+ guestpath = nil
28
+ end
16
29
  end
17
30
 
18
- # clear prior directory if exists
19
- if comm.test("test -d \"#{guestpath}\"", sudo: true)
20
- comm.sudo("rm -Rf \"#{guestpath}\"")
31
+ # Remove existing symlink or directory if defined
32
+ if guestpath
33
+ if comm.test("test -L \"#{guestpath}\"")
34
+ comm.sudo("rm -f \"#{guestpath}\"")
35
+ elsif comm.test("test -d \"#{guestpath}\"")
36
+ comm.sudo("rm -Rf \"#{guestpath}\"")
37
+ end
38
+
39
+ # create intermediate directories if needed
40
+ intermediate_dir = File.dirname(guestpath)
41
+ if intermediate_dir != "/"
42
+ comm.sudo("mkdir -p \"#{intermediate_dir}\"")
43
+ end
44
+
45
+ comm.sudo("ln -s \"/Volumes/VMware Shared Folders/#{name}\" \"#{guestpath}\"")
21
46
  end
22
47
 
23
- # create intermediate directories if needed
24
- intermediate_dir = File.dirname(guestpath)
25
- if !comm.test("test -d \"#{intermediate_dir}\"", sudo: true)
26
- comm.sudo("mkdir -p \"#{intermediate_dir}\"")
48
+ if firmlink && !system_firmlink?(firmlink)
49
+ if guestpath.nil?
50
+ guestpath = "/Volumes/VMware Shared Folders/#{name}"
51
+ else
52
+ guestpath = File.join("/System/Volumes/Data", firmlink)
53
+ end
54
+
55
+ share_line = "#{firmlink}\t#{guestpath}"
56
+
57
+ # Check if the line is already defined. If so, bail since we are done
58
+ if !comm.test("[[ \"$(</etc/synthetic.conf)\" = *\"#{share_line}\"* ]]")
59
+ @apply_firmlinks[machine.id][:bootstrap] = true
60
+ end
61
+
62
+ # If we haven't already added our hook to apply firmlinks, do it now
63
+ if @apply_firmlinks[machine.id][:content].empty?
64
+ Plugin.action_hook(:apfs_firmlinks, :after_synced_folders) do |hook|
65
+ action = proc { |*_|
66
+ content = @apply_firmlinks[machine.id][:content].join("\n")
67
+ # Write out the synthetic file
68
+ comm.sudo("echo -e #{content.inspect} > /etc/synthetic.conf")
69
+ if @apply_firmlinks[:bootstrap]
70
+ # Re-bootstrap the root container to pick up firmlink updates
71
+ comm.sudo("/System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -B")
72
+ end
73
+ }
74
+ hook.prepend(action)
75
+ end
76
+ end
77
+ @apply_firmlinks[machine.id][:content] << share_line
27
78
  end
79
+ end
80
+ end
28
81
 
29
- # finally make the symlink
30
- comm.sudo("ln -s \"/Volumes/VMware Shared Folders/#{name}\" \"#{guestpath}\"")
82
+ # Check if firmlink is provided by the system
83
+ #
84
+ # @param [String] firmlink Firmlink path
85
+ # @return [Boolean]
86
+ def self.system_firmlink?(firmlink)
87
+ if !@_firmlinks
88
+ if File.exist?("/usr/share/firmlinks")
89
+ @_firmlinks = File.readlines("/usr/share/firmlinks").map do |line|
90
+ line.split.first
91
+ end
92
+ else
93
+ @_firmlinks = []
94
+ end
31
95
  end
96
+ firmlink = "/#{firmlink}" if !firmlink.start_with?("/")
97
+ @_firmlinks.include?(firmlink)
98
+ end
99
+
100
+ # @private
101
+ # Reset the cached values for capability. This is not considered a public
102
+ # API and should only be used for testing.
103
+ def self.reset!
104
+ instance_variables.each(&method(:remove_instance_variable))
32
105
  end
33
106
  end
34
107
  end
@@ -0,0 +1,42 @@
1
+ require "log4r"
2
+
3
+ module VagrantPlugins
4
+ module GuestLinux
5
+ module Cap
6
+ class Reboot
7
+ MAX_REBOOT_RETRY_DURATION = 120
8
+
9
+ def self.reboot(machine)
10
+ @logger = Log4r::Logger.new("vagrant::linux::reboot")
11
+ reboot_script = "reboot"
12
+
13
+ comm = machine.communicate
14
+
15
+ @logger.debug("Issuing reboot command for guest")
16
+ comm.sudo(reboot_script)
17
+
18
+ machine.ui.info(I18n.t("vagrant.guests.capabilities.rebooting"))
19
+
20
+ @logger.debug("Waiting for machine to finish rebooting")
21
+
22
+ wait_remaining = MAX_REBOOT_RETRY_DURATION
23
+ begin
24
+ wait_for_reboot(machine)
25
+ rescue Vagrant::Errors::MachineGuestNotReady => e
26
+ raise if wait_remaining < 0
27
+ @logger.warn("Machine not ready, cannot start reboot yet. Trying again")
28
+ sleep(5)
29
+ wait_remaining -= 5
30
+ retry
31
+ end
32
+ end
33
+
34
+ def self.wait_for_reboot(machine)
35
+ while !machine.guest.ready?
36
+ sleep 10
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -82,6 +82,16 @@ module VagrantPlugins
82
82
  Cap::ReadIPAddress
83
83
  end
84
84
 
85
+ guest_capability(:linux, :wait_for_reboot) do
86
+ require_relative "cap/reboot"
87
+ Cap::Reboot
88
+ end
89
+
90
+ guest_capability(:linux, :reboot) do
91
+ require_relative "cap/reboot"
92
+ Cap::Reboot
93
+ end
94
+
85
95
  guest_capability(:linux, :remove_public_key) do
86
96
  require_relative "cap/public_key"
87
97
  Cap::PublicKey
@@ -5,7 +5,7 @@ module VagrantPlugins
5
5
  def self.nfs_client_install(machine)
6
6
  machine.communicate.sudo <<-EOH.gsub(/^ {12}/, '')
7
7
  if command -v dnf; then
8
- if `dnf info -q libnfs-utils > /dev/null 2>&1` ; then
8
+ if `dnf info -q libnfs-utils > /dev/null 2>&1` ; then
9
9
  dnf -y install nfs-utils libnfs-utils portmap
10
10
  else
11
11
  dnf -y install nfs-utils nfs-utils-lib portmap
@@ -15,7 +15,7 @@ module VagrantPlugins
15
15
  fi
16
16
 
17
17
  if test $(ps -o comm= 1) == 'systemd'; then
18
- /bin/systemctl restart rpcbind nfs
18
+ /bin/systemctl restart rpcbind nfs-server
19
19
  else
20
20
  /etc/init.d/rpcbind restart
21
21
  /etc/init.d/nfs restart
@@ -5,8 +5,8 @@ module VagrantPlugins
5
5
  def self.change_host_name(machine, name)
6
6
  comm = machine.communicate
7
7
 
8
- if !comm.test("getent hosts '#{name}'", sudo: false)
9
- basename = name.split(".", 2)[0]
8
+ basename = name.split(".", 2)[0]
9
+ if !comm.test('test "$(hostnamectl --static status)" = "#{basename}"', sudo: false)
10
10
  comm.sudo <<-EOH.gsub(/^ {14}/, '')
11
11
  hostnamectl set-hostname '#{basename}'
12
12
 
@@ -0,0 +1,11 @@
1
+ module VagrantPlugins
2
+ module HostDarwin
3
+ module Cap
4
+ class NFS
5
+ def self.nfs_exports_template(environment)
6
+ "nfs/exports_darwin"
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -55,6 +55,11 @@ module VagrantPlugins
55
55
  require_relative "cap/configured_ip_addresses"
56
56
  Cap::ConfiguredIPAddresses
57
57
  end
58
+
59
+ host_capability("darwin", "nfs_exports_template") do
60
+ require_relative "cap/nfs"
61
+ Cap::NFS
62
+ end
58
63
  end
59
64
  end
60
65
  end
@@ -77,7 +77,7 @@ module VagrantPlugins
77
77
  sleep 0.5
78
78
 
79
79
  nfs_cleanup("#{Process.uid} #{id}")
80
- output = "#{nfs_exports_content}\n#{output}"
80
+ output = nfs_exports_content + output
81
81
  nfs_write_exports(output)
82
82
 
83
83
  if nfs_running?(nfs_check_command)
@@ -93,7 +93,7 @@ module VagrantPlugins
93
93
  "systemctl --no-pager --no-legend --plain list-unit-files --all --type=service " \
94
94
  "| grep #{nfs_service_name_systemd}").exit_code == 0
95
95
  else
96
- Vagrant::Util::Subprocess.execute("modinfo", "nfsd").exit_code == 0 ||
96
+ Vagrant::Util::Subprocess.execute(modinfo_path, "nfsd").exit_code == 0 ||
97
97
  Vagrant::Util::Subprocess.execute("grep", "nfsd", "/proc/filesystems").exit_code == 0
98
98
  end
99
99
  end
@@ -261,6 +261,24 @@ module VagrantPlugins
261
261
  Vagrant::Util::Subprocess.execute(*Shellwords.split(check_command)).exit_code == 0
262
262
  end
263
263
 
264
+ def self.modinfo_path
265
+ if !defined?(@_modinfo_path)
266
+ @_modinfo_path = Vagrant::Util::Which.which("modinfo")
267
+
268
+ if @_modinfo_path.to_s.empty?
269
+ path = "/sbin/modinfo"
270
+ if File.file?(path)
271
+ @_modinfo_path = path
272
+ end
273
+ end
274
+
275
+ if @_modinfo_path.to_s.empty?
276
+ @_modinfo_path = "modinfo"
277
+ end
278
+ end
279
+ @_modinfo_path
280
+ end
281
+
264
282
  # @private
265
283
  # Reset the cached values for capability. This is not considered a public
266
284
  # API and should only be used for testing.
@@ -0,0 +1,168 @@
1
+ require "log4r"
2
+ require "securerandom"
3
+
4
+ require "vagrant/util/numeric"
5
+
6
+ module VagrantPlugins
7
+ module Kernel_V2
8
+ class VagrantConfigDisk < Vagrant.plugin("2", :config)
9
+ #-------------------------------------------------------------------
10
+ # Config class for a given Disk
11
+ #-------------------------------------------------------------------
12
+
13
+ DEFAULT_DISK_TYPES = [:disk, :dvd, :floppy].freeze
14
+
15
+ # Note: This value is for internal use only
16
+ #
17
+ # @return [String]
18
+ attr_reader :id
19
+
20
+ # File name for the given disk. Defaults to a generated name that is:
21
+ #
22
+ # vagrant_<disk_type>_<short_uuid>
23
+ #
24
+ # @return [String]
25
+ attr_accessor :name
26
+
27
+ # Type of disk to create. Defaults to `:disk`
28
+ #
29
+ # @return [Symbol]
30
+ attr_accessor :type
31
+
32
+ # Size of disk to create
33
+ #
34
+ # @return [Integer,String]
35
+ attr_accessor :size
36
+
37
+ # Path to the location of the disk file (Optional)
38
+ #
39
+ # @return [String]
40
+ attr_accessor :file
41
+
42
+ # Determines if this disk is the _main_ disk, or an attachment.
43
+ # Defaults to true.
44
+ #
45
+ # @return [Boolean]
46
+ attr_accessor :primary
47
+
48
+ # Provider specific options
49
+ #
50
+ # @return [Hash]
51
+ attr_accessor :provider_config
52
+
53
+ def initialize(type)
54
+ @logger = Log4r::Logger.new("vagrant::config::vm::disk")
55
+
56
+ @type = type
57
+ @provider_config = {}
58
+
59
+ @name = UNSET_VALUE
60
+ @provider_type = UNSET_VALUE
61
+ @size = UNSET_VALUE
62
+ @primary = UNSET_VALUE
63
+ @file = UNSET_VALUE
64
+
65
+ # Internal options
66
+ @id = SecureRandom.uuid
67
+ end
68
+
69
+ # Helper method for storing provider specific config options
70
+ #
71
+ # Expected format is:
72
+ #
73
+ # - `provider__diskoption: value`
74
+ # - `{provider: {diskoption: value, otherdiskoption: value, ...}`
75
+ #
76
+ # Duplicates will be overriden
77
+ #
78
+ # @param [Hash] options
79
+ def add_provider_config(**options, &block)
80
+ current = {}
81
+ options.each do |k,v|
82
+ opts = k.to_s.split("__")
83
+
84
+ if opts.size == 2
85
+ current[opts[0].to_sym] = {opts[1].to_sym => v}
86
+ elsif v.is_a?(Hash)
87
+ current[k] = v
88
+ else
89
+ @logger.warn("Disk option '#{k}' found that does not match expected provider disk config schema.")
90
+ end
91
+ end
92
+
93
+ current = @provider_config.merge(current) if !@provider_config.empty?
94
+ @provider_config = current
95
+ end
96
+
97
+ def finalize!
98
+ # Ensure all config options are set to nil or default value if untouched
99
+ # by user
100
+ @type = :disk if @type == UNSET_VALUE
101
+ @size = nil if @size == UNSET_VALUE
102
+ @file = nil if @file == UNSET_VALUE
103
+
104
+ if @primary == UNSET_VALUE
105
+ @primary = false
106
+ end
107
+
108
+ if @name == UNSET_VALUE
109
+ if @primary
110
+ @name = "vagrant_primary"
111
+ else
112
+ @name = "name_#{@type.to_s}_#{@id.split("-").last}"
113
+ end
114
+ end
115
+
116
+ @provider_config = nil if @provider_config == {}
117
+ end
118
+
119
+ # @return [Array] array of strings of error messages from config option validation
120
+ def validate(machine)
121
+ errors = _detected_errors
122
+
123
+ # validate type with list of known disk types
124
+
125
+ if !DEFAULT_DISK_TYPES.include?(@type)
126
+ errors << I18n.t("vagrant.config.disk.invalid_type", type: @type,
127
+ types: DEFAULT_DISK_TYPES.join(', '))
128
+ end
129
+
130
+ if @size && !@size.is_a?(Integer)
131
+ if @size.is_a?(String)
132
+ @size = Vagrant::Util::Numeric.string_to_bytes(@size)
133
+ end
134
+
135
+ if !@size
136
+ errors << I18n.t("vagrant.config.disk.invalid_size", name: @name, machine: machine.name)
137
+ end
138
+ end
139
+
140
+ if @file
141
+ if !@file.is_a?(String)
142
+ errors << I18n.t("vagrant.config.disk.invalid_file_type", file: @file, machine: machine.name)
143
+ elsif !File.file?(@file)
144
+ errors << I18n.t("vagrant.config.disk.missing_file", file_path: @file,
145
+ name: @name, machine: machine.name)
146
+ end
147
+ end
148
+
149
+ if @provider_config
150
+ if !@provider_config.keys.include?(machine.provider_name)
151
+ machine.env.ui.warn(I18n.t("vagrant.config.disk.missing_provider",
152
+ machine: machine.name,
153
+ provider_name: machine.provider_name))
154
+ end
155
+ end
156
+
157
+ errors
158
+ end
159
+
160
+ # The String representation of this Disk.
161
+ #
162
+ # @return [String]
163
+ def to_s
164
+ "disk config"
165
+ end
166
+ end
167
+ end
168
+ end