Make name required for defining non-primary disks

This commit is contained in:
Brian Cain 2020-01-13 15:24:15 -08:00
parent ec350861cd
commit ffe8fcef9b
No known key found for this signature in database
GPG Key ID: 9FC4639B2E4510A0
2 changed files with 8 additions and 3 deletions

View File

@ -110,9 +110,8 @@ module VagrantPlugins
@name = "vagrant_primary"
else
# TODO: Can't rely on `id` because it changes in between vagrant runs
#
# INSTEAD: Make name a hard requirement, and see if that solves things
@name = "vagrant_#{@type.to_s}_#{@id.split("-").last}"
#@name = "vagrant_#{@type.to_s}_#{@id.split("-").last}"
@name = nil
end
end
@ -157,6 +156,10 @@ module VagrantPlugins
end
end
if !@name
errors << I18n.t("vagrant.config.disk.no_name_set", machine: machine.name)
end
errors
end

View File

@ -1812,6 +1812,8 @@ en:
Disk file '%{file_path}' for disk '%{name}' on machine '%{machine}' does not exist.
missing_provider: |-
Guest '%{machine}' using provider '%{provider_name}' has provider specific config options for a provider other than '%{provider_name}'. These provider config options will be ignored for this guest
no_name_set: |-
A 'name' option is required when defining a disk for guest '%{machine}'.
common:
bad_field: "The following settings shouldn't exist: %{fields}"
chef: