Fix issue with local data store not being properly cleared for VM destruction
This commit is contained in:
parent
b7788e3c06
commit
5a13347fb4
|
@ -89,9 +89,9 @@ module Vagrant
|
|||
env.local_data[:active] ||= {}
|
||||
|
||||
if value && value.uuid
|
||||
env.local_data[:active][name.to_sym] = value.uuid
|
||||
env.local_data[:active][name.to_s] = value.uuid
|
||||
else
|
||||
env.local_data[:active].delete(name.to_sym)
|
||||
env.local_data[:active].delete(name.to_s)
|
||||
end
|
||||
|
||||
# Commit the local data so that the next time vagrant is initialized,
|
||||
|
|
|
@ -26,6 +26,13 @@ class DataStoreTest < Test::Unit::TestCase
|
|||
assert_equal @initial_data["foo"], @instance[:foo]
|
||||
end
|
||||
|
||||
should "read the data by stringifying keys" do
|
||||
@instance[:bar] = { "baz" => "yay" }
|
||||
@instance.commit
|
||||
@instance = @klass.new(@db_file)
|
||||
assert_equal "yay", @instance[:bar]["baz"]
|
||||
end
|
||||
|
||||
should "write the data, but not save it right away" do
|
||||
@instance[:foo] = "changed"
|
||||
assert_equal "changed", @instance[:foo]
|
||||
|
|
|
@ -57,13 +57,13 @@ class VMTest < Test::Unit::TestCase
|
|||
should "add the VM to the active list" do
|
||||
assert @env.local_data.empty?
|
||||
@vm.vm = @raw_vm
|
||||
assert_equal @raw_vm.uuid, @env.local_data[:active][@vm.name.to_sym]
|
||||
assert_equal @raw_vm.uuid, @env.local_data[:active][@vm.name.to_s]
|
||||
end
|
||||
|
||||
should "remove the VM from the active list if nil is given" do
|
||||
@env.local_data[:active] = { @vm.name.to_sym => "foo" }
|
||||
@env.local_data[:active] = { @vm.name.to_s => "foo" }
|
||||
|
||||
assert @env.local_data[:active].has_key?(@vm.name.to_sym) # sanity
|
||||
assert @env.local_data[:active].has_key?(@vm.name.to_s) # sanity
|
||||
@vm.vm = nil
|
||||
|
||||
# This becomes empty because vm= will commit the local data which
|
||||
|
|
Loading…
Reference in New Issue