Merge pull request #3592 from mitchellh/reboot-capability-should-fix-symlinks
guests/windows: reboot capability should fix symlinks
This commit is contained in:
commit
cadd7f602c
|
@ -12,6 +12,10 @@ module VagrantPlugins
|
||||||
while machine.communicate.execute(script, error_check: false) != 0
|
while machine.communicate.execute(script, error_check: false) != 0
|
||||||
sleep 10
|
sleep 10
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# This re-establishes our symbolic links if they were
|
||||||
|
# created between now and a reboot
|
||||||
|
machine.communicate.execute("net use", error_check: false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -62,14 +62,6 @@ module VagrantPlugins
|
||||||
@machine.guest.capability(:wait_for_reboot)
|
@machine.guest.capability(:wait_for_reboot)
|
||||||
end
|
end
|
||||||
|
|
||||||
if windows?
|
|
||||||
# This re-establishes our symbolic links if they were
|
|
||||||
# created between now and a reboot
|
|
||||||
@machine.communicate.execute(
|
|
||||||
"& net use a-non-existant-share",
|
|
||||||
error_check: false)
|
|
||||||
end
|
|
||||||
|
|
||||||
command = build_command(:client)
|
command = build_command(:client)
|
||||||
|
|
||||||
@config.attempts.times do |attempt|
|
@config.attempts.times do |attempt|
|
||||||
|
|
|
@ -138,14 +138,6 @@ module VagrantPlugins
|
||||||
@machine.guest.capability(:wait_for_reboot)
|
@machine.guest.capability(:wait_for_reboot)
|
||||||
end
|
end
|
||||||
|
|
||||||
if windows?
|
|
||||||
# This re-establishes our symbolic links if they were
|
|
||||||
# created between now and a reboot
|
|
||||||
@machine.communicate.execute(
|
|
||||||
"& net use a-non-existant-share",
|
|
||||||
error_check: false)
|
|
||||||
end
|
|
||||||
|
|
||||||
command = build_command(:solo)
|
command = build_command(:solo)
|
||||||
|
|
||||||
@config.attempts.times do |attempt|
|
@config.attempts.times do |attempt|
|
||||||
|
|
|
@ -101,14 +101,6 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
|
|
||||||
def run_puppet_apply
|
def run_puppet_apply
|
||||||
if windows?
|
|
||||||
# This re-establishes our symbolic links if they were
|
|
||||||
# created between now and a reboot
|
|
||||||
@machine.communicate.execute(
|
|
||||||
"& net use a-non-existant-share",
|
|
||||||
error_check: false)
|
|
||||||
end
|
|
||||||
|
|
||||||
default_module_path = "/etc/puppet/modules"
|
default_module_path = "/etc/puppet/modules"
|
||||||
if windows?
|
if windows?
|
||||||
default_module_path = "/ProgramData/PuppetLabs/puppet/etc/modules"
|
default_module_path = "/ProgramData/PuppetLabs/puppet/etc/modules"
|
||||||
|
|
|
@ -9,7 +9,7 @@ describe "VagrantPlugins::GuestWindows::Cap::Reboot" do
|
||||||
let(:vm) { double("vm") }
|
let(:vm) { double("vm") }
|
||||||
let(:config) { double("config") }
|
let(:config) { double("config") }
|
||||||
let(:machine) { double("machine") }
|
let(:machine) { double("machine") }
|
||||||
let(:communicator) { double(:execute) }
|
let(:communicator) { double("communicator") }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
allow(machine).to receive(:communicate).and_return(communicator)
|
allow(machine).to receive(:communicate).and_return(communicator)
|
||||||
|
@ -18,37 +18,37 @@ describe "VagrantPlugins::GuestWindows::Cap::Reboot" do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "winrm communicator" do
|
describe "winrm communicator" do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
allow(vm).to receive(:communicator).and_return(:winrm)
|
allow(vm).to receive(:communicator).and_return(:winrm)
|
||||||
end
|
end
|
||||||
|
|
||||||
describe ".wait_for_reboot" do
|
describe ".wait_for_reboot" do
|
||||||
|
|
||||||
it "runs reboot detect script" do
|
it "runs reboot detect script" do
|
||||||
expect(communicator).to receive(:execute) do |cmd|
|
expect(communicator).to receive(:execute).with(/# Function/, { error_check: false }).and_return(0)
|
||||||
expect(cmd).to include("SM_SHUTTINGDOWN")
|
allow(communicator).to receive(:execute)
|
||||||
end.and_return(0)
|
|
||||||
described_class.wait_for_reboot(machine)
|
described_class.wait_for_reboot(machine)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "fixes symlinks to network shares" do
|
||||||
|
allow(communicator).to receive(:execute).and_return(0)
|
||||||
|
expect(communicator).to receive(:execute).with('net use', { error_check: false })
|
||||||
|
|
||||||
|
described_class.wait_for_reboot(machine)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "ssh communicator" do
|
describe "ssh communicator" do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
allow(vm).to receive(:communicator).and_return(:ssh)
|
allow(vm).to receive(:communicator).and_return(:ssh)
|
||||||
end
|
end
|
||||||
|
|
||||||
describe ".wait_for_reboot" do
|
describe ".wait_for_reboot" do
|
||||||
|
it "does not execute Windows reboot detect script" do
|
||||||
it "runs reboot detect script" do
|
|
||||||
expect(communicator).to_not receive(:execute)
|
expect(communicator).to_not receive(:execute)
|
||||||
described_class.wait_for_reboot(machine)
|
described_class.wait_for_reboot(machine)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue