diff --git a/lib/vagrant/machine.rb b/lib/vagrant/machine.rb index 9b646bba9..8ebdd4636 100644 --- a/lib/vagrant/machine.rb +++ b/lib/vagrant/machine.rb @@ -254,6 +254,7 @@ module Vagrant if index_uuid.nil? # Create the index entry and save it entry = MachineIndex::Entry.new + entry.extra_data["box"] = @config.vm.box entry.local_data_path = @env.local_data_path entry.name = @name.to_s entry.provider = @provider_name.to_s diff --git a/lib/vagrant/machine_index.rb b/lib/vagrant/machine_index.rb index ab4015ebd..0ebd5c780 100644 --- a/lib/vagrant/machine_index.rb +++ b/lib/vagrant/machine_index.rb @@ -378,6 +378,8 @@ module Vagrant # The parameter given should be nil if this is being created # publicly. def initialize(id=nil, raw=nil) + @extra_data = {} + # Do nothing if we aren't given a raw value. Otherwise, parse it. return if !raw diff --git a/test/unit/vagrant/machine_test.rb b/test/unit/vagrant/machine_test.rb index e289c4028..e479b2e25 100644 --- a/test/unit/vagrant/machine_test.rb +++ b/test/unit/vagrant/machine_test.rb @@ -403,11 +403,22 @@ describe Vagrant::Machine do end it "is set one when setting an ID" do + subject.config.vm.box = "FOO" subject.id = "foo" uuid = subject.index_uuid expect(uuid).to_not be_nil expect(new_instance.index_uuid).to eq(uuid) + + # Test the entry itself + entry = env.machine_index.get(uuid) + expect(entry.extra_data["box"]).to eq(subject.config.vm.box) + expect(entry.name).to eq(subject.name) + expect(entry.provider).to eq(subject.provider_name.to_s) + expect(entry.state).to eq("preparing") + expect(entry.vagrantfile_path).to eq(env.root_path) + expect(entry.vagrantfile_name).to eq(env.vagrantfile_name) + env.machine_index.release(entry) end it "deletes the UUID when setting to nil" do