core: instantiate all keys in a V2 config prior to merging

This forces everything to get a new instance, so we don't accidentally
overwrite any values across multiple machines.
This commit is contained in:
Mitchell Hashimoto 2014-04-16 15:32:31 -07:00
parent 3edfe6deaf
commit 4df8636c38
1 changed files with 10 additions and 0 deletions

View File

@ -51,6 +51,16 @@ module Vagrant
old_state = old.__internal_state
new_state = new.__internal_state
# Make sure we instantiate every key in the config so that we
# merge every key. This avoids issues with the same reference
# being part of the config.
old_state["config_map"].each do |k, _|
old.send(k)
end
new_state["config_map"].each do |k, _|
new.send(k)
end
# The config map for the new object is the old one merged with the
# new one.
config_map = old_state["config_map"].merge(new_state["config_map"])