Rename drives to disks to match class, and properly merge configs

This commit is contained in:
Brian Cain 2019-10-23 13:41:30 -07:00
parent 28d339eac5
commit 393ce9eb1b
No known key found for this signature in database
GPG Key ID: 9FC4639B2E4510A0
1 changed files with 20 additions and 9 deletions

View File

@ -80,7 +80,7 @@ module VagrantPlugins
@__compiled_provider_configs = {} @__compiled_provider_configs = {}
@__defined_vm_keys = [] @__defined_vm_keys = []
@__defined_vms = {} @__defined_vms = {}
@__drives = [] @__disks = []
@__finalized = false @__finalized = false
@__networks = {} @__networks = {}
@__providers = {} @__providers = {}
@ -125,10 +125,22 @@ module VagrantPlugins
end end
end end
# Merge defined drives # Merge defined disks
# TODO: Actually write this other_disks = other.instance_variable_get(:@__disks)
other_drives = other.instance_variable_get(:@__drives) new_disks = @__disks.dup
new_drives = @__drives.dup @__disks.each do |d|
other_d = other_disks.find { |o| d.id == o.id }
if other_d
# There is an override. Take it.
other_d.config = d.config.merge(other_p.config)
end
# There is an override, merge it into the
new_disks << d.dup
end
other_disks.each do |d|
new_disks << d.dup
end
# Merge the providers by prepending any configuration blocks we # Merge the providers by prepending any configuration blocks we
# have for providers onto the new configuration. # have for providers onto the new configuration.
@ -192,7 +204,7 @@ module VagrantPlugins
result.instance_variable_set(:@__defined_vm_keys, new_defined_vm_keys) result.instance_variable_set(:@__defined_vm_keys, new_defined_vm_keys)
result.instance_variable_set(:@__defined_vms, new_defined_vms) result.instance_variable_set(:@__defined_vms, new_defined_vms)
result.instance_variable_set(:@__drives, new_drives) result.instance_variable_set(:@__disks, new_disks)
result.instance_variable_set(:@__providers, new_providers) result.instance_variable_set(:@__providers, new_providers)
result.instance_variable_set(:@__provider_order, new_order) result.instance_variable_set(:@__provider_order, new_order)
result.instance_variable_set(:@__provider_overrides, new_overrides) result.instance_variable_set(:@__provider_overrides, new_overrides)
@ -402,8 +414,7 @@ module VagrantPlugins
disk.add_config(options, &block) disk.add_config(options, &block)
@__drives << disk @__disks << disk
end end
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -570,7 +581,7 @@ module VagrantPlugins
end end
# TODO: This might need to be more complicated # TODO: This might need to be more complicated
@__drives.each do |d| @__disks.each do |d|
d.finalize! d.finalize!
end end