I’m running into this issue with Windows Server nodes and am hoping other
chefs on this list can help:
A Windows node executes chef-client. The first resource in its collection
is a windows_feature resource which installs a role which requires a reboot
to complete installation. dism.exe installs the role and returns 3010
indicating the need for a reboot, which causes that resource to fail and
ends the chef run. chef-client will fail at this point every time it runs
until the system is rebooted. I could set ignore_failure on the resource
to true, but the second resource in the node’s collection requires that the
Windows role is fully installed (i.e. the system has been rebooted) to
complete successfully, so it too will fail until the system is rebooted.
Some possible solutions I can see:
- Ignore failure on resource #1 but them immediately notify a script
resource that restarts the system. This seems heavy-handed since it
reboots the system in the middle of the chef run. Also, there may be cases
in which the feature will install without requiring a reboot, and in these
cases, the system will be rebooted unnecessarily. This is my current
method of dealing with the problem.
- Modify the windows_feature provider by adding an "allow_reboot"
attribute. If “allow_reboot” is set to true, then it will call dism.exe
without the “/norestart” flag, so that dism can restart the system itself.
This will only reboot the system if the feature installation requires it,
but it still reboots the system in the middle of the chef run.
- Modify windows_feature to optionally raise an exception to stop the chef
run if a reboot is required, and create an error handler that will reboot
the system on this type of exception. This seems cleaner but is perhaps
One might encounter this problem in other contexts as well.
“windows_package” springs to mind as another resource type where you may
want to conditionally trigger a system reboot before continuing with the
rest of a chef run. Has anyone discovered a good way to deal with this kind
University of Minnesota