I hacked together some Powershell that did a few things:
- Parses the chef-client output to look for the reboot strings that occur in the reboot handler using a regex.
- Sleeps for a minute
- Waits in a loop for the server to come back and be responsive - I decided on a simple remote invoke-command $True.
- Does a chef-client again, and goes back to #1 above in a loop
It is far from perfect, but seems pretty ok.
The only time we ran into issues with the reboot looping is when the cookbook failed, and the reboot never triggered. This is because the handler is registered on for Report. Registering the reboot handler for Exceptions, in addition to Report, should fix that issue so the reboot happens on error or on success.