Ohai Chefs!
We are happy to announce release of Chef v12.16.42!
Release Highlights
attribute_changed
event hook
In a cookbook library file, you can add this in order to print out all attribute changes in cookbooks:
Chef.event_handler do
on :attribute_changed do |precedence, key, value|
puts "setting attribute #{precedence}#{key.map {|n| "[\"#{n}\"]" }.join} = #{value}"
end
end
If you want to setup a policy that override attributes should never be used:
Chef.event_handler do
on :attribute_changed do |precedence, key, value|
raise "override policy violation" if precedence == :override
end
end
Automatic connection to Chef Automate’s Data Collector with supported Chef Server
Chef Client will automatically attempt to connect to the Chef Server authenticated data collector proxy. If you have a supported version of Chef Server and have enabled this feature on the Chef Server, Chef Client run data will automatically be forwarded to Automate without additional Chef Client configuration. If you do not have Automate or the feature is disabled on the Chef Server, Chef Client will detect this and disable data collection.
Note that Chef Server 12.11.0+ is required for this feature.
RFC018 Partially Implemented: Specify --field-separator
for attribute filtering
If you have periods (.
) in your Chef Node attribute keys, you can now pass the --field-separator
(or -S
) flag along with your --attribute
(or -a
) flag to specify a custom nesting character other than .
.
In a situation where the webapp node has the following node data:
{
"foo.bar": "baz",
"alpha": {
"beta": "omega"
}
}
Running knife node show
with the default field separator (.
) won’t show
us the data we’re expecting for some attributes:
$ knife node show webapp -a foo.bar
webapp:
foo.bar:
$ knife node show webapp -a alpha.beta
webapp:
alpha.beta: omega
However, by specifying a field separator other than .
we’re now able to show
the data.
$ knife node show webapp -S: -a foo.bar
webapp:
foo.bar: baz
$ knife node show webapp -S: -a alpha:beta
webapp:
alpha:beta: omega
Please see the CHANGELOG.md for the complete list of changes.
Getting the Build
As always, you can download binaries directly from downloads.chef.io or by using the new mixlib-install download
command now available in ChefDK 0.19.6 or greater.
$ mixlib-install download chef -v 12.16.42
Alternatively, you can install them now using one of the following command options:
# In Linux Shell
$ curl https://omnitruck.chef.io/install.sh | sudo bash -s -- -P chef -v 12.16.42
# In Windows Powershell
> . { iwr -useb https://omnitruck.chef.io/install.ps1 } | iex; install -project chef -version 12.16.42
If you want to give this a spin in Test-Kitchen, create or add the following to a .kitchen.local.yml file and have fun!
provisioner:
product_name: chef
product_version: 12.16.42