Idempotence is one of the principles of the chef.
This means that your recipe can be repeated over and over again, and it will only change things that are not expected.
So, in your case, it will look like this:
- First Chef launches notifications that an unexpected kernel has been installed. Thus, the kernel is installed and a reboot is started.
- Chef starts again, indicates that the kernel is installed as expected, and thus simply continues. Now you can continue other things.
One note: I have never tried this, but a reboot alarm in the middle of a cook's run can cause some damage. I would recommend interrupting the chef after the reboot signal (for example, by raising an exception, see How do you interrupt / terminate the chef? ).
source share