-- via my feedly.com reader
We're very excited to announce the release of Chef Client 12.5, which you can obtain via our downloads page. This release has several important new features that we'd like to highlight, so read on for more details.
New custom resource model
One of the greatest things about Chef is its easy extensibility. You can easily add new resource types that represent abstractions for your particular problem domain. While doing so, you can re-use existing built-in Chef resources as building blocks – or even use other people's custom resources. An example of this would be to add a website resource type to Chef, which you could imagine might be composed of a package, service and template resource.
In Chef Client 12.5, we've drastically simplified the amount of code you need to write to make custom resources. In particular:
- You no longer need to write a separate provider in the
providers/directory of a cookbook.
- A lot of the boilerplate is being eliminated (like
- The syntax generally for writing resources is drastically simpler.
In addition, we will no longer be referring to custom resources using cumbersome terms like LWRP or HWRP. Henceforth, they will just be "custom resources".
While all your existing resource & provider code will continue to work, we think you'll appreciate and want to use the new, streamlined syntax. We've prepared some materials to help you learn about it:
- This in-browser presentation deck will introduce the concept of a custom resource and how to write one.
- The Chef Docs (now with a new UI) includes up-to-date information on this topic.
We think you'll want to use the new custom resource model right away, but realize that not everyone can adopt Chef Client 12.5 immediately. To ease the transition, we've published a compat_resource cookbook to the Supermarket that will bring the same syntax to Chef Client 12.1 through 12.4 until you can transition fully to Chef Client 12.5.
Finally, we will be running a webinar on October 28th with Chef Principal Engineer, John Keiser, who will discuss the changes and walk through a live example of building a custom resource using the new language.
Inline Event Handlers in Recipes
Another powerful feature of Chef is the event dispatch system, which allows customers to have Chef call custom logic during different phases of the Chef client run (e.g. client registration, converge start/end, failed run, etc.) In the past, it has been very difficult for customers to use this feature, because it required them to install and register an event dispatch extension externally.
In Chef Client 12.5, you can write and register these callbacks inline in a recipe. You can write any arbitrary Ruby inline, or invoke one or more methods that are provided by classes inside the libraries directory of Chef.
A concrete use case for this feature would be to register a handler to lock a global mutex in etcd at the beginning of a Chef run, and release that lock at the end of a run, thereby ensuring that in a cluster only one machine is modifying a particular data structure at a time.
Chef Policy Improvements
As we near the final release of the Chef Policy feature, we are incrementally making changes to both Chef Client and Server to support these capabilities. In Chef Client 12.5, it is possible to configure clients to operate in policy mode by using
policy_group as node attributes, rather than having to set these directives in
client.rb. You will need Chef Server 12.2.0 or above in order to take full advantage of this feature.
While we don't yet consider Chef Policy feature complete for general adoption, we already have a number of users in our community and customers utilizing this feature to replace roles, environments and run lists. Community member Michael Hedgpeth has written an excellent article on this topic on his blog. We also invite you to watch the recording of the webinar on Chef Policy by Chef's own Joshua Timberman, or read the blog post introducing the work.
While there are many more changes in Chef Client 12.5, we felt that these were the most significant and warrant the most attention. You should read the Chef Client 12.5 release notes for information on all the new features and fixed bugs in this release. Once again, thanks for using Chef, and we hope you enjoy this release.