Add file option to disk config

This commit is contained in:
Brian Cain 2019-10-30 13:35:21 -07:00
parent f01c90e676
commit d54e870752
No known key found for this signature in database
GPG Key ID: 9FC4639B2E4510A0
1 changed files with 16 additions and 0 deletions

View File

@ -34,6 +34,12 @@ module VagrantPlugins
# @return [Integer]
attr_accessor :size
# Path to the location of the disk file (Optional)
#
# @return [String]
attr_accessor :file
# Determines if this disk is the _main_ disk, or an attachment.
# Defaults to true.
#
@ -64,6 +70,7 @@ module VagrantPlugins
@primary = UNSET_VALUE
@config = nil
@invalid = false
@file = UNSET_VALUE
# Internal options
@id = SecureRandom.uuid
@ -101,6 +108,7 @@ module VagrantPlugins
# by user
@type = :disk if @type == UNSET_VALUE
@size = nil if @size == UNSET_VALUE
@file = nil if @file == UNSET_VALUE
if @primary == UNSET_VALUE
@primary = true
@ -130,6 +138,14 @@ module VagrantPlugins
errors << "Config option size for disk is not an integer"
end
if @file
if !@file.is_a?(String)
errors << "Config option `file` for #{machine.name} disk config is not a string"
else
# Validate that file exists
end
end
errors
end