(#19162) Support immediate reboots

This commit changes the `when` parameter to a property, so that we can
manage the reboot pending state of the system.

It adds a `:immediate` value which if set will perform a reboot immediately
regardless of whether a reboot is pending or not.