Merge pull request #9578 from ajpaul25/fix_windows_change_change_host_name_timeout
Fix graceful_halt_timeout issue #8486
This commit is contained in:
commit
43293a81b2
|
@ -28,7 +28,12 @@ module VagrantPlugins
|
||||||
error_key: :rename_computer_failed)
|
error_key: :rename_computer_failed)
|
||||||
|
|
||||||
# Don't continue until the machine has shutdown and rebooted
|
# Don't continue until the machine has shutdown and rebooted
|
||||||
sleep(sleep_timeout)
|
if machine.guest.capability?(:wait_for_reboot)
|
||||||
|
machine.guest.capability(:wait_for_reboot)
|
||||||
|
else
|
||||||
|
# use graceful_halt_timeout only if guest cannot wait for reboot
|
||||||
|
sleep(sleep_timeout)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -34,6 +34,9 @@ describe "VagrantPlugins::GuestWindows::Cap::ChangeHostName" do
|
||||||
'if (!([System.Net.Dns]::GetHostName() -eq \'newhostname\')) { exit 0 } exit 1',
|
'if (!([System.Net.Dns]::GetHostName() -eq \'newhostname\')) { exit 0 } exit 1',
|
||||||
exit_code: 0)
|
exit_code: 0)
|
||||||
communicator.stub_command(rename_script, exit_code: 0)
|
communicator.stub_command(rename_script, exit_code: 0)
|
||||||
|
allow(machine).to receive(:guest)
|
||||||
|
allow(machine.guest).to receive(:capability)
|
||||||
|
allow(machine.guest).to receive(:capability?)
|
||||||
described_class.change_host_name_and_wait(machine, 'newhostname', 0)
|
described_class.change_host_name_and_wait(machine, 'newhostname', 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue