Add disk name for disk config

This commit is contained in:
Brian Cain 2019-10-23 14:14:38 -07:00
parent 995c4bbc60
commit ee751ca6e1
No known key found for this signature in database
GPG Key ID: 9FC4639B2E4510A0
2 changed files with 5 additions and 2 deletions

View File

@ -112,8 +112,9 @@ module VagrantPlugins
@size = nil if @size == UNSET_VALUE @size = nil if @size == UNSET_VALUE
@primary = true if @primary == UNSET_VALUE @primary = true if @primary == UNSET_VALUE
# generate name instead of nil if unset_value # Give the disk a default name if unset
@name = nil if @name == UNSET_VALUE # TODO: Name not required if primray?
@name = "vagrant_#{@type.to_s}_#{@id.split("-").last}" if @name == UNSET_VALUE
@config = nil if @config == UNSET_VALUE @config = nil if @config == UNSET_VALUE
end end

View File

@ -791,6 +791,8 @@ module VagrantPlugins
errors << "There is more than one disk defined for guest '#{machine.name}'. Please pick a `primary` disk." errors << "There is more than one disk defined for guest '#{machine.name}'. Please pick a `primary` disk."
end end
# TODO: Check for duplicate disk names?
@__disks.each do |d| @__disks.each do |d|
error = d.validate(machine) error = d.validate(machine)
errors.concat error if !error.empty? errors.concat error if !error.empty?