core: trigger machine_id_changed for reload [GH-3963]
This commit is contained in:
parent
1ee46d3c95
commit
cff57c8d01
|
@ -20,10 +20,17 @@ BUG FIXES:
|
||||||
- providers/docker: `vagrant share` uses correct IP of proxy VM if it
|
- providers/docker: `vagrant share` uses correct IP of proxy VM if it
|
||||||
exists. [GH-4342]
|
exists. [GH-4342]
|
||||||
- providers/docker: `vagrant\_vagrantfile` expands home directory. [GH-4000]
|
- providers/docker: `vagrant\_vagrantfile` expands home directory. [GH-4000]
|
||||||
|
- providers/docker: Fix issue where multiple identical proxy VMs would
|
||||||
|
be created. [GH-3963]
|
||||||
- providers/virtualbox: Show a human-friendly error if VirtualBox didn't
|
- providers/virtualbox: Show a human-friendly error if VirtualBox didn't
|
||||||
clean up an existing VM. [GH-4681]
|
clean up an existing VM. [GH-4681]
|
||||||
- provisioners/docker: Search for docker binary in multiple places. [GH-4580]
|
- provisioners/docker: Search for docker binary in multiple places. [GH-4580]
|
||||||
|
|
||||||
|
PLUGIN AUTHOR CHANGES:
|
||||||
|
|
||||||
|
- `Machine#reload` will now properly trigger the `machine\_id\_changed`
|
||||||
|
callback on providers.
|
||||||
|
|
||||||
## 1.6.5 (September 4, 2014)
|
## 1.6.5 (September 4, 2014)
|
||||||
|
|
||||||
BUG FIXES:
|
BUG FIXES:
|
||||||
|
|
|
@ -342,6 +342,7 @@ module Vagrant
|
||||||
|
|
||||||
# This reloads the ID of the underlying machine.
|
# This reloads the ID of the underlying machine.
|
||||||
def reload
|
def reload
|
||||||
|
old_id = @id
|
||||||
@id = nil
|
@id = nil
|
||||||
|
|
||||||
if @data_dir
|
if @data_dir
|
||||||
|
@ -350,6 +351,13 @@ module Vagrant
|
||||||
id_file = @data_dir.join("id")
|
id_file = @data_dir.join("id")
|
||||||
@id = id_file.read.chomp if id_file.file?
|
@id = id_file.read.chomp if id_file.file?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if @id != old_id && @provider
|
||||||
|
# It changed, notify the provider
|
||||||
|
@provider.machine_id_changed
|
||||||
|
end
|
||||||
|
|
||||||
|
@id
|
||||||
end
|
end
|
||||||
|
|
||||||
# This returns the SSH info for accessing this machine. This SSH info
|
# This returns the SSH info for accessing this machine. This SSH info
|
||||||
|
|
|
@ -44,6 +44,13 @@ module VagrantPlugins
|
||||||
proxy_ui.opts[:prefix_spaces] = true
|
proxy_ui.opts[:prefix_spaces] = true
|
||||||
proxy_ui.opts[:target] = env[:machine].name.to_s
|
proxy_ui.opts[:target] = env[:machine].name.to_s
|
||||||
|
|
||||||
|
# Reload the machine so that if it was created while we didn't
|
||||||
|
# hold the lock, we'll see the updated state.
|
||||||
|
host_machine.reload
|
||||||
|
|
||||||
|
p host_machine.id
|
||||||
|
p host_machine.ssh_info
|
||||||
|
|
||||||
# See if the machine is ready already. If not, start it.
|
# See if the machine is ready already. If not, start it.
|
||||||
if host_machine.communicate.ready?
|
if host_machine.communicate.ready?
|
||||||
env[:machine].ui.detail(I18n.t("docker_provider.host_machine_ready"))
|
env[:machine].ui.detail(I18n.t("docker_provider.host_machine_ready"))
|
||||||
|
|
|
@ -451,11 +451,12 @@ describe Vagrant::Machine do
|
||||||
describe "#reload" do
|
describe "#reload" do
|
||||||
before do
|
before do
|
||||||
allow(provider).to receive(:machine_id_changed)
|
allow(provider).to receive(:machine_id_changed)
|
||||||
|
|
||||||
subject.id = "foo"
|
subject.id = "foo"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should read the ID" do
|
it "should read the ID" do
|
||||||
|
expect(provider).to_not receive(:machine_id_changed)
|
||||||
|
|
||||||
subject.reload
|
subject.reload
|
||||||
|
|
||||||
expect(subject.id).to eq("foo")
|
expect(subject.id).to eq("foo")
|
||||||
|
@ -464,6 +465,8 @@ describe Vagrant::Machine do
|
||||||
it "should read the updated ID" do
|
it "should read the updated ID" do
|
||||||
new_instance.id = "bar"
|
new_instance.id = "bar"
|
||||||
|
|
||||||
|
expect(provider).to receive(:machine_id_changed)
|
||||||
|
|
||||||
subject.reload
|
subject.reload
|
||||||
|
|
||||||
expect(subject.id).to eq("bar")
|
expect(subject.id).to eq("bar")
|
||||||
|
|
Loading…
Reference in New Issue