Merge pull request #8874 from taliesins/HandleChefProvisionerRebootRequest
Handle chef provisioner reboot request
This commit is contained in:
commit
fb1501d48a
|
@ -32,6 +32,11 @@ if (ShuttingDown) {
|
|||
exit 2
|
||||
}
|
||||
|
||||
if ($LASTEXITCODE -eq 1115) {
|
||||
# A system shutdown is in progress
|
||||
exit 2
|
||||
}
|
||||
|
||||
# Remove the pending reboot we just created above
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
. shutdown.exe -a
|
||||
|
|
|
@ -73,16 +73,22 @@ module VagrantPlugins
|
|||
@machine.ui.warn(I18n.t("vagrant.chef_run_list_empty"))
|
||||
end
|
||||
|
||||
if @machine.guest.capability?(:wait_for_reboot)
|
||||
@machine.guest.capability(:wait_for_reboot)
|
||||
end
|
||||
|
||||
command = CommandBuilder.command(:client, @config,
|
||||
windows: windows?,
|
||||
colored: @machine.env.ui.color?,
|
||||
)
|
||||
|
||||
still_active = 259 #provisioner has asked chef to reboot
|
||||
|
||||
@config.attempts.times do |attempt|
|
||||
exit_status = 0
|
||||
while exit_status == 0 || exit_status == still_active
|
||||
if @machine.guest.capability?(:wait_for_reboot)
|
||||
@machine.guest.capability(:wait_for_reboot)
|
||||
elsif attempt > 0
|
||||
sleep 10
|
||||
@machine.communicate.wait_for_ready(@machine.config.vm.boot_timeout)
|
||||
end
|
||||
if attempt == 0
|
||||
@machine.ui.info I18n.t("vagrant.provisioners.chef.running_client")
|
||||
else
|
||||
|
@ -103,6 +109,7 @@ module VagrantPlugins
|
|||
# There is no need to run Chef again if it converges
|
||||
return if exit_status == 0
|
||||
end
|
||||
end
|
||||
|
||||
# If we reached this point then Chef never converged! Error.
|
||||
raise ChefError, :no_convergence
|
||||
|
|
|
@ -176,17 +176,23 @@ module VagrantPlugins
|
|||
@machine.ui.warn(I18n.t("vagrant.chef_run_list_empty"))
|
||||
end
|
||||
|
||||
if @machine.guest.capability?(:wait_for_reboot)
|
||||
@machine.guest.capability(:wait_for_reboot)
|
||||
end
|
||||
|
||||
command = CommandBuilder.command(:solo, @config,
|
||||
windows: windows?,
|
||||
colored: @machine.env.ui.color?,
|
||||
legacy_mode: @config.legacy_mode,
|
||||
)
|
||||
|
||||
still_active = 259 #provisioner has asked chef to reboot
|
||||
|
||||
@config.attempts.times do |attempt|
|
||||
exit_status = 0
|
||||
while exit_status == 0 || exit_status == still_active
|
||||
if @machine.guest.capability?(:wait_for_reboot)
|
||||
@machine.guest.capability(:wait_for_reboot)
|
||||
elsif attempt > 0
|
||||
sleep 10
|
||||
@machine.communicate.wait_for_ready(@machine.config.vm.boot_timeout)
|
||||
end
|
||||
if attempt == 0
|
||||
@machine.ui.info I18n.t("vagrant.provisioners.chef.running_solo")
|
||||
else
|
||||
|
@ -207,6 +213,7 @@ module VagrantPlugins
|
|||
# There is no need to run Chef again if it converges
|
||||
return if exit_status == 0
|
||||
end
|
||||
end
|
||||
|
||||
# If we reached this point then Chef never converged! Error.
|
||||
raise ChefError, :no_convergence
|
||||
|
|
|
@ -56,17 +56,23 @@ module VagrantPlugins
|
|||
@machine.ui.warn(I18n.t("vagrant.chef_run_list_empty"))
|
||||
end
|
||||
|
||||
if @machine.guest.capability?(:wait_for_reboot)
|
||||
@machine.guest.capability(:wait_for_reboot)
|
||||
end
|
||||
|
||||
command = CommandBuilder.command(:client, @config,
|
||||
windows: windows?,
|
||||
colored: @machine.env.ui.color?,
|
||||
local_mode: true,
|
||||
)
|
||||
|
||||
still_active = 259 #provisioner has asked chef to reboot
|
||||
|
||||
@config.attempts.times do |attempt|
|
||||
exit_status = 0
|
||||
while exit_status == 0 || exit_status == still_active
|
||||
if @machine.guest.capability?(:wait_for_reboot)
|
||||
@machine.guest.capability(:wait_for_reboot)
|
||||
elsif attempt > 0
|
||||
sleep 10
|
||||
@machine.communicate.wait_for_ready(@machine.config.vm.boot_timeout)
|
||||
end
|
||||
if attempt == 0
|
||||
@machine.ui.info I18n.t("vagrant.provisioners.chef.running_zero")
|
||||
else
|
||||
|
@ -87,6 +93,7 @@ module VagrantPlugins
|
|||
# There is no need to run Chef again if it converges
|
||||
return if exit_status == 0
|
||||
end
|
||||
end
|
||||
|
||||
# If we reached this point then Chef never converged! Error.
|
||||
raise ChefError, :no_convergence
|
||||
|
|
Loading…
Reference in New Issue