Fixup disk config parsing to allow hash and block
This commit is contained in:
parent
7cfccb5cfd
commit
ad73969010
|
@ -84,7 +84,7 @@ module VagrantPlugins
|
|||
|
||||
current = @config_class.new
|
||||
current.set_options(options) if options
|
||||
block.call(current) if block
|
||||
block.call(current) if block_given?
|
||||
current = @config.merge(current) if @config
|
||||
@config = current
|
||||
end
|
||||
|
@ -121,7 +121,7 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
# TODO: Convert a string to int here?
|
||||
if !@size.is_a?(Integer)
|
||||
if @size && !@size.is_a?(Integer)
|
||||
errors << "Config option size for disk is not an integer"
|
||||
end
|
||||
|
||||
|
|
|
@ -406,12 +406,14 @@ module VagrantPlugins
|
|||
|
||||
def disk(type, **options, &block)
|
||||
disk = VagrantConfigDisk.new(type)
|
||||
if block.is_a?(Hash)
|
||||
disk.set_options(block)
|
||||
else
|
||||
|
||||
disk.set_options(options)
|
||||
|
||||
if block_given?
|
||||
block.call(disk, VagrantConfigDisk)
|
||||
end
|
||||
|
||||
# Add provider config
|
||||
disk.add_config(options, &block)
|
||||
|
||||
@__disks << disk
|
||||
|
|
Loading…
Reference in New Issue