ChefDK 1.4.3 Upgrade

I finally found some time to upgrade and test ChefDK 1.3 from 1.2.22 this weekend.  When I went to download the bits I found 1.4.3 is now the latest stable release.  Chef moves fast!

image

The install was quick and painless, as usual.

Chef Development Kit Version: 1.4.3
chef-client version: 12.19.36
delivery version: master (41b94ffb5efd33723cf72a89bf4d273c8151c9dc)
berks version: 5.6.4
kitchen version: 1.16.0
inspec version: 1.25.1

Testing

I’m specifically testing the cookbook I wrote for my PowerShell Summit talk “TDD with Chef, PowerShell, DSC and Pester on Windows”.  The source is available on Github at

http://www.dotnetcatch.com/2017/04/11/talk-recap-tdd-with-chef-powershell-dsc-and-pester/

Converge is Faster

First, I tested the cookbook on Nano.  Everything worked the first time and it was faster.  The converge step specifically was only 2 minutes and 36 seconds which previously took 4 minutes and 12 sec using the older version.  That is 1.5 minutes or almost 40% faster for the converge step.

Finished converging <acme-win-webdefault-nano> (2m36.20s)..

Next I ran the cookbook against 2008R2 hoping to see similar or better speed improvements but the converge time improvement wasn’t as significant at only 10 seconds less.  One difference though is the converge included the reboot time for the VM after the PowerShell 5 install which added 10 seconds or so. So overall, I would guestimate it’s about 20 seconds faster. This wasn’t a very scientific test however so take it for what you will. 

Wait for Reboot

Handling reboots has always been a problem with Windows and Chef.  Not anymore!  Steven Murawski announced support for reboots with Test-Kitchen last year but now its in the box with the ChefDK.

Previously, Chef would simply throw an exception saying a reboot was required and then you would need to run converge again to finish the Chef client run. 

           Chef Client finished, 2/4 resources updated in 01 minutes 42 seconds
       [2017-05-21T05:18:46-07:00] WARN: Rebooting server at a recipe’s request. Details: {:delay_mins=>0, :reason=>”Reboot by Chef”, :timestamp=>2017-05-21 05:18:46 -0700, :requested_by=>”powershell”}

           Running handlers:
       [2017-05-21T05:18:46-07:00] ERROR: Running exception handlers
           Running handlers complete
       [2017-05-21T05:18:46-07:00] ERROR: Exception handlers complete
           Chef Client failed. 2 resources updated in 01 minutes 42 seconds
       [2017-05-21T05:18:46-07:00] FATAL: Stacktrace dumped to C:/Users/ADMINI~1/AppData/Local/Temp/kitchen/cache/chef-stacktrace.out
       [2017-05-21T05:18:46-07:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
       [2017-05-21T05:18:46-07:00] FATAL: Chef::Exceptions::Reboot: Rebooting server at a recipe’s request. Details: {:delay_mins=>0, :reason=>”Reboot by Chef”, :timestamp=>2017-05-21 05:18:46 -0700, :requested_by=>”powershell”}
>>>>>> ——Exception——-
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>>     Converge failed on instance <acme-win-webdefault-win2008r2>.  Please see .kitchen/logs/acme-win-webdefault-win2008r2.log for more details
>>>>>> ———————-
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose –all` for configuration

Now this is all handled and Kitchen waits for the reboot to complete then proceeds normally.  This solves a huge pain point with Chef on Windows!

Summary

This was by no means a comprehensive testing session but from my experience ChefDK v1.4.3 is a great upgrade.  No refactoring required (at least for my test cookbook) and its faster.  I’m sure there are many other benefits in the latest development kit but this is what I found over the weekend.

Next I will upgrade my work machine and test my other production cookbooks but I expect the same results.  If I have any issues or find new improvements I will share them here on my blog.

Happy Upgrading!

Please follow and like us:

Leave a Reply