- From: Daniel DeLeo <
>
- To: Chef Dev <
>,
- Subject: [chef] Chef 0.9.0 Release Candidate Available
- Date: Wed, 16 Jun 2010 23:51:20 -0700
Ohai Chefs!
Chef 0.9.0 is almost here, so I'd like to give you an update on what you can
expect in the new version, and how you can start using Chef 0.9.0 today. There
are a few breaking changes you should be aware of--please read on--but you "I
run as root" types can install right now with `gem install chef --pre` and
`gem install chef-server --pre`. The current prerelease version is the second
release candidate, chef-0.9.0.rc02
### Summary Updates in 0.9.0 ###
* Attribute precedence has been updated, and makes much more sense now. You
can read the bug report[1] on JIRA to get all the gory details, but the
quick explanation is that you can now access default and override attributes
in your attribute files, and default and override attributes you set in
roles will behave like you'd expect. For example, you can now ship your
cookbooks with a set of "sane" default attributes using the default keyword
in the attributes file:
# Imaginary MySQL Cookbook Attributes File:
default[:mysql][:bind_address] = 'localhost'
default[:mysql][:datadir] = '/var/lib/mysql'
These attributes will have the lowest precedence of any attributes in the
system, so you can override it with a role: # Imaginary MySQL Server Role
default_attributes :mysql => {:bindaddress => '0.0.0.0'} And the defaults in
this role "win" over the defaults in the cookbook.
* chef-server now supports cookbook versioning, atomic cookbook updates, and
per-file synchronization. Cookbooks are now uploaded file by file to a
sandbox, then committed when the entire cookbook has been successfully
uploaded, and the layout of the cookbooks is tracked in the database. 0.9.0
Uses this to enable rudimentary support for versioned cookbooks, but the
main driver of this change is to lay the groundwork for our upcoming support
of environments--i.e., the ability to assign versions of cookbooks to your
various staging, production, QA, etc. environments.
* Notification support: You can now configure chef-client to run one or more
notification handlers after a successful or unsuccessful run. We are only
shipping with a simple handler that records results to a JSON formatted
file, but I'm sure we'll see the options expand very soon. If you're
interested in writing a notification handler, you should get acquainted with
the Chef::Handler[2] base class code before diving in. Take a peek at our
JsonFile[3] handler to see one example; I've included another at the bottom
of this message.
* chef-server and the WebUI now run on Merb 1.1.0, and you can now run the
full Chef stack on Ruby 1.9. Ruby 1.9 users will also want to install the
prerelease version of mixlib-config.
* Improved Windows support, including a resource and provider to set your
environment in Windows[4], user and group providers[5], and a mount
provider[6], as well as new ohai plugins for windows. Props to Doug
MacEachern for all of his hard work on this. Please that we don't yet have a
prerelease gem available for the next version of ohai, I will update this
list when one becomes available.
* The rubygems provider has been rewritten to use the rubygems ruby API, while
still supporting multiple gem installations. The new provider is much faster
than the old one one when a node already has the correct gem version
installed.
* And a ton of bug fixes and other improvements that I can't list here. Thanks
to all of you who contributed code, bug reports, participated on the mailing
list and IRC channel. Chef would not be where it is today without your help.
### Upgrading ###
We're still working out the optimal upgrade strategy, but it's been relatively
painless in my testing. The basic process I have followed is like this:
0. Create backups and try it in a test enviroment first. But you know
that already.
1. Stop chef-server, chef-server-webui, chef-solr-indexer, and chef-solr.
2. Upgrade the gems:
sudo gem install chef --pre
sudo gem install chef-server --pre
3. Install Bundler: Merb 1.1.1 requires bundler but the gem does not express a
dependency on it, so you need to install bundler manually.
sudo gem install bundler
4. Edit the server configuration file (server.rb). The new cookbook
upload/download system needs two directories to upload and store cookbooks:
# The defaults are /var/chef:
sandbox_path "/var/chef/sandboxes"
checksum_path "/var/chef/checksums"
# Edit these to taste. This is sensible for a bootstrap-installed server:
sandbox_path "/srv/chef/sandboxes"
checksum_path "/srv/chef/checksums"
5. Start chef-solr, chef-solr-indexer, chef-server, and chef-server-webui
6. You will have to re-upload your cookbooks: Run `knife cookbook upload -a -o
/path/to/cookbooks` after upgrading the box you run knife from to 0.9.0.
7. Knife clients should work fine after installing 0.9.0; chef-clients
also must be
upgraded.
### Links ###
1.
http://tickets.opscode.com/browse/CHEF-838
2.
http://github.com/opscode/chef/blob/master/chef/lib/chef/handler.rb
3.
http://github.com/opscode/chef/blob/master/chef/lib/chef/handler/json_file.rb
4.
http://github.com/opscode/chef/blob/master/chef/lib/chef/resource/env.rb
5. Commit:
http://github.com/opscode/chef/commit/fc032dc0f76d378640116136b7e9b4c79b10a95d
6. Commit:
http://github.com/opscode/chef/commit/eeaba657fc31e0e36825a989e5a40cd7a9882d89
### Example Notification Handler ###
Here's a notification/exception handler that just logs everything via
Chef::Log:
LogItHandler < Chef::Handler
# Define a report method to run your notification logic
def report
# write your notification code here.
# you can access the start_time, end_time, node, exception (if any),
# backtrace (if any), success/failure status of the run, and a list
# of all resources and all updated resources. Be careful, these can
# be nil if chef crashed very early in the run.
Chef::Log.info("report for #{node.name}")
# In the final release, you'll be able to access the elapsed_time
directly
Chef::Log.info("run completed in #{run_status.elapsed_time} seconds")
if success?
Chef::Log.info("Updated #{updated_resources.size} of
#{all_resources.size} resources")
else
Chef::Log.info("Sad panda: chef run failed with exception
#{exception.inspect}")
backtrace.each {|line| Chef::Log.info(line) }
end
end
In your client configuration file, you enable the handler like this:
report_handlers << LogItHandler.new # these fire at the end of
a successful run
exception_handlers << LogItHandler.new # these fire at the end of
a failed run
We hope you enjoy this release. Please share any tips or questions you might
have on the installation or upgrade process, or about this release in general,
either here or on the IRC channel.
Daniel DeLeo
- [chef] Chef 0.9.0 Release Candidate Available, Daniel DeLeo, 06/16/2010
Archive powered by MHonArc 2.6.16.