diff --git a/lib/vagrant/vm.rb b/lib/vagrant/vm.rb index 1ce8a07ca..26414e481 100644 --- a/lib/vagrant/vm.rb +++ b/lib/vagrant/vm.rb @@ -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, diff --git a/test/vagrant/data_store_test.rb b/test/vagrant/data_store_test.rb index 221e4c914..61f117495 100644 --- a/test/vagrant/data_store_test.rb +++ b/test/vagrant/data_store_test.rb @@ -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] diff --git a/test/vagrant/vm_test.rb b/test/vagrant/vm_test.rb index d88c89929..5b2070698 100644 --- a/test/vagrant/vm_test.rb +++ b/test/vagrant/vm_test.rb @@ -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