Why does Chef throw fatal error on restart request

1k Views Asked by At

I'm trying to use a log filter on client.log to evaluate if Chef runs succeeded.

In the normal course of a Chef run, my recipe requests a reboot.

Chef logs:

  FATAL: Chef::Exceptions::Reboot: Rebooting server at a recipe's request. 

Why does Chef throw an error with a normal reboot request? How can I prevent this error from being logged.

My reboot request looks like

reboot "my_reboot" do
  action :reboot_now
  reason 'There is a pending reboot.'
  only_if { reboot_pending? }
  delay_mins 0.5
end
1

There are 1 best solutions below

2
On

Because we want to avoid running anything further in the Chef converge and the easiest way to do that is to raise an exception.