How to wait for machine to reboot in the middle of a recipe?


I have a bootstrap recipe that is supposed to rename the system and join domain and then requires a reboot in the middle of a recipe. I know that I will need to create a scheduled task or a service to let chef-client run on its own after reboot. Now I am putting this recipe in the machine resource itself so that bootstrapping starts after machine comes up. But as soon as the machine reboots in the middle of this recipe run, the machine converge gets completed with Error code 35. Reboot_Scheduled. Is there a way to make the provisioner node wait for the machine to reboot and then continue the converge?

I also see this message in the end
WARN: Per RFC 062 (, when a reboot is requested Chef Client will exit with an exit code of 35, REBOOT_SCHEDULED. To maintain the current behavior (an exit code of 0), you will need to set 'exit_status' to ':disabled' in your client.rb at C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.14.89-universal-mingw32/bin/chef-client:26:in '<top (required)>' at C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.14.89-universal-mingw32/lib/chef/event_dispatch/dispatcher.rb:43:in call

but if I put this line exit_status :disabled in provisioner node’s client.rb file it doesn’t make any difference.