Hook into ValidateDiskExt capability
This commit is contained in:
parent
883e45cc49
commit
21954c29af
@ -294,7 +294,7 @@ module VagrantPlugins
|
||||
dsk_info[:port] = port.to_s
|
||||
|
||||
# Check for a free device
|
||||
if port_attachments.detect { |a| a[:device] == "0" }
|
||||
if port_attachments.any? { |a| a[:device] == "0" }
|
||||
dsk_info[:device] = "1"
|
||||
else
|
||||
dsk_info[:device] = "0"
|
||||
|
||||
@ -1,12 +1,11 @@
|
||||
require_relative "../cap/validate_disk_ext"
|
||||
|
||||
module VagrantPlugins
|
||||
module ProviderVirtualBox
|
||||
module Model
|
||||
# A collection of storage controllers. Includes finder methods to look
|
||||
# up a storage controller by given attributes.
|
||||
class StorageControllerArray < Array
|
||||
# TODO: hook into ValidateDiskExt capability
|
||||
DEFAULT_DISK_EXT = [".vdi", ".vmdk", ".vhd"].map(&:freeze).freeze
|
||||
|
||||
# Returns a storage controller with the given name. Raises an
|
||||
# exception if a matching controller can't be found.
|
||||
#
|
||||
@ -86,8 +85,12 @@ module VagrantPlugins
|
||||
# @param [Hash] attachment - Attachment information
|
||||
# @return [Boolean]
|
||||
def hdd?(attachment)
|
||||
ext = File.extname(attachment[:location].to_s).downcase
|
||||
DEFAULT_DISK_EXT.include?(ext)
|
||||
if !attachment
|
||||
false
|
||||
else
|
||||
ext = File.extname(attachment[:location].to_s).downcase.split('.').last
|
||||
VagrantPlugins::ProviderVirtualBox::Cap::ValidateDiskExt.validate_disk_ext(nil, ext)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user