[chef] Re: Windows nodes requiring a reboot after feature installation


Chronological Thread 
  • From: Andrea Campi < >
  • To: " " < >
  • Subject: [chef] Re: Windows nodes requiring a reboot after feature installation
  • Date: Thu, 7 Feb 2013 09:26:34 +0100

I trust you've seen http://tickets.opscode.com/browse/COOK-2336 and the linked pull request? It was reviewed this week so I guess it will be merged soon.

The chef-client cookbook also has a handler that can perform a reboot.

It doesn't look like the two provide a complete solution to your needs, but it shouldn't be too hard to wire things together to perform a reboot when necessary.


On Thu, Feb 7, 2013 at 1:36 AM, Adam Mielke < " target="_blank"> > wrote:
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:
1. 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.
2. 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.
3. 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 overkill?

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 of situation?

--
Adam Mielke
System Engineer
University of Minnesota





Archive powered by MHonArc 2.6.16.

§