Merge pull request #9578 from ajpaul25/fix_windows_change_change_host_name_timeout

Fix graceful_halt_timeout issue #8486
This commit is contained in:
Brian Cain 2018-03-16 13:34:23 -07:00 committed by GitHub
commit 43293a81b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -28,7 +28,12 @@ module VagrantPlugins
error_key: :rename_computer_failed)
# 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

View File

@ -34,6 +34,9 @@ describe "VagrantPlugins::GuestWindows::Cap::ChangeHostName" do
'if (!([System.Net.Dns]::GetHostName() -eq \'newhostname\')) { exit 0 } exit 1',
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)
end