Chef Blogs

Chef 0.9.10, Ohai 0.5.8, and Mixlib::Log 1.2.0 Released!

Dan DeLeo | Posted on | release | Releases

Today we have a triple release of Chef, Ohai and Mixlib::Log, with more than 75 bug fixes, improvements, and new features.

A Sharper Knife

Chef 0.9.10 features many improvements to knife. One of the most exciting improvements comes courtesy of Doug MacEachern: a bootstrap script for windows. The windows bootstrap uses VBScript and psexec to install Ruby and Chef on a remote host, so you need to run it from another Windows machine. Doug also added support for HTTP HEAD requests and custom headers to the http_request resource, which allows you to use If-Modified-Since to check if a file has been updated on the server before downloading.

Avishai Ish-Shalom fixed a common annoyance with knife ssh where if one host was down, the entire command would fail. Knife will now issue a warning for each host that it can’t connect to instead of failing outright. knife ssh also has much better messaging when required gems aren’t installed, thanks to former MVP Akzhan Abdulin.

Also new in knife this release is knife exec, which lets you runs scripts using all the new shef API interaction we added in 0.9.8. For example, you can add your new base role to all of your nodes with a one liner like this:

knife exec -E 'nodes.transform(:all) {|n| n.run_list << "role[base]" }'

To get acquainted with everything you can do with knife exec, start shef and run the help command, or check out the shef docs on the wiki.

Knife also gets a much more robust knife ec2 server create in this release. In previous versions of Chef, this command would often hang when connecting to the newly launched EC2 instance. The problem should now be completely fixed.

Thanks to John Alberts, knife now has a much friendlier error message when using knife cookbook site vendor with a misconfigured cookbook_path.

Simpler Notifications

Another notable improvement in Chef 0.9.10 is that we’ve made it much easier to send notifications to resources when another resource is updated. Previously, you could only define a notification if the resource you wanted to notify was already defined, but now you can notify resources that are defined later in a recipe. For example, you can notify your webserver to restart when its config file changes like this:

template "/etc/www/configures-apache.conf" do
  # other parameters
  notifies :restart, "service[apache]"
end

service "apache" do
  # parameters
end

For more detail about the new syntax, take a look at the updated docs on the topic. The old syntax for notifications will continue to work, of course.

We’ve got a lot of improvements to the way we index documents in Solr in the pipeline for Chef 0.10 but the first bit of work we’ve done is included in 0.9.10: chef-solr-indexer is about eight times faster than in 0.9.8. Part of this speedup comes from escaping data for XML using a C extension instead of a slower pure Ruby version. If you’re running a large Chef installation and want to take advantage of this speed improvement, just install the fast_xs gem on your chef-solr-indexer box and it will be used automatically. If you have a smaller Chef installation and you don’t want to deal with the additional dependency, you don’t have to do anything—Chef will fall back to the pure ruby code when fast_xs is not installed.

Special Thanks

Among the community contributors to this release, there were two standouts: Toomas Pelberg and Tommy Bishop. Toomas and Tommy contributed a combined twenty patches to this release, so they are your 0.9.10 Co-MVPs. Toomas made a bunch of improvements to get our test suite working correctly on multiple platforms, which will make it even easier for new developers to hack on Chef, and also fixed a tricky bug with Chef’s handling of nil attributes. Thanks, Toomas!

Tommy Bishop is a relative newcomer to the Chef development community, but he hasn’t wasted any opportunity to make Chef better, fixing bugs in the route provider, subversion provider, Chef Solr, and Ruby 1.9 compatibility bugs in knife. Tommy includes extensive test suites with every patch, which is totally awesome.

The route provider also got some love from Jesse Nelson, who updated its internals to work correctly with refactoring we’d previously done on Chef’s internal run state handling.

New developers will also appreciate Christopher Peplin’s fixes to our README, which now accurately lists the gems required to get a development environment up and running. Of course, if you’re an aspiring Chef hacker, don’t be afraid to drop by the #chef-hacking channel on freenode where our developer community is ready to answer any development questions you have.

Matthew Kent continues to do great work, this time tracking down and fixing a tricky bug where the yum package provider could break when the showdupesfromrepos setting was enabled. Also on the RedHat/CentOS front, Gilles Devaux improved our bundled init scripts for those platforms.

The Web UI got a bit of polish this go-around, thanks to Dimitri Krassovski, who fixed a bug where roles were not being correctly highlighted when manipulating run lists, and Akzhan Abdulin who contributed a patch to display the Chef version. We also got some fit and finish in our error messages courtesy of Warwick Poole.

Michael Leinartas contributed a trio of tasty patches. Michael implemented the create_if_missing action for remote directories, fixed the notification system to check not_if and only_if before firing notified actions, and wrote a resource and provider for reloading ohai data. Nice work, Michael!

I’d also like to thank everyone who contributed by testing the RCs, participating on IRC and the mailing lists. Even though you might not show up in the commit logs, your help is invaluable in making Chef and the community around it awesome.

Mixlib::Log and Ohai Updates

Mixlib::Log and Ohai also received minor updates today. Mixlib::Log 1.2.0 fixes a bug where the logger could inadvertently get initialized with incorrect settings. Ohai 0.5.8 brings Amazon Linux platform support and an updates its dependency on the JSON gem to match the update in Chef.

Before You Upgrade

Since Chef 0.8.0, the chef-client has kept a cache of the checksums of the files it manages to avoid constantly recalculating them on subsequent runs. Unfortunately, Chef didn’t bother to clean up cached checksum files that had become irrelevant until 0.9.10. On older hosts, you may have hundreds of thousands of these stale checksum files in your /var/chef/cache/checksums (by default) directory. The very first time you run chef-client after upgrading, it will clean out the old checksums from this directory. If you have a huge number of these checksums, chef-client may peg a CPU for a short time while it clears them out. If you need to avoid this, you can simply delete all of the checksums from the directory with an out-of-band mechanism before upgrading.

If you are running Chef Server installed from Opscode’s Apt packages, be aware that the 0.9.8 (and earlier) packages were configured to store uploaded cookbooks in the same directory that the client used to store these cached checksums. The 0.9.10 packages will use an updated configuration to store the cookbook components and cached checksums in separate directories. Unfortunately, this means that the 0.9.10 apt packages will be delayed while we test the upgrade process.

Aside from those caveats, upgrading is as easy as installing the updated code. The client and server will work with any 0.9.x version of the other, so you can upgrade them as it’s convenient.


Release Notes – Chef – Version 0.9.10

Bug

  • [CHEF-767] – Git resource setting updated too often, causing notifications to trigger inappropriately
  • [CHEF-871] – Chef::Node::Attribute can’t handle false/nil
  • [CHEF-899] – Service can’t depend on config file that restarts service
  • [CHEF-1152] – Scientific Linux missing from chef/lib/platform.rb
  • [CHEF-1286] – JSON Attribs and precedence
  • [CHEF-1302] – using content parameter with file results in empty file getting created, then clobbered
  • [CHEF-1322] – Need to rescue timeouts in chef-solr-indexer
  • [CHEF-1333] – Route resource puts in "via" when gateway is not specified
  • [CHEF-1344] – chef-client run with a tty should not use interval and splay in client.rb
  • [CHEF-1364] – Cannot purge the checksum documents from couchdb
  • [CHEF-1397] – chef-client does not clean up cached template checksums
  • [CHEF-1422] – rpm_package returns NoMethodError
  • [CHEF-1452] – Executes with action :nothing still trigger immediate notifications
  • [CHEF-1460] – knife —version prints a FATAL message for no reason
  • [CHEF-1485] – knife ec2 server create hangs on bootstrap
  • [CHEF-1505] – Chef Solr also needs to hide the net/http bug (undefined method `closed?’ for nil:NilClass)
  • [CHEF-1518] – Action:export does not work for subversion
  • [CHEF-1519] – only_if and not_if aren’t checked when resource is run by a notifies or subscribes
  • [CHEF-1529] – file_spec expects Chef::Config.file_backup_path to be writeable
  • [CHEF-1532] – knife ec2 server create broken on ruby 1.9
  • [CHEF-1534] – cookbook_version.rb defines several methods multiple times
  • [CHEF-1536] – knife cookbook metadata assumes cookbook_path is an array though it’s allowed to be a string
  • [CHEF-1537] – Cannot Determine if root user is locked on CentOS
  • [CHEF-1538] – knife ssh doesn’t support the -P or —ssh-pasword options correctly
  • [CHEF-1539] – Minor tweak for rest-client upgrade
  • [CHEF-1542] – route provider is improperly using @collection
  • [CHEF-1543] – Solaris returns "Not owner" instead of "Operation not permitted" in daemon_spec.rb
  • [CHEF-1544] – yum provider improperly tries to update lesser versions of packages
  • [CHEF-1556] – Cannot see Files content of cookbooks in webui
  • [CHEF-1560] – ‘knife cookbook upload’ fails to upload freshly generated metadata.json
  • [CHEF-1564] – knife bootstrap should always try to install chef
  • [CHEF-1570] – knife "cookbook site share" throws NoMethodError
  • [CHEF-1571] – Uploading new version of cookbook fails on first attempt, succeeds on second attempt
  • [CHEF-1578] – provider/link spec test failure
  • [CHEF-1580] – user::dscl provider tests fail with Errno::ENOENT: No such file or directory – dscl . -list /Users uid
  • [CHEF-1581] – Chef Solr Indexer is slow
  • [CHEF-1582] – knife configure client should use IO objects instead of system cp
  • [CHEF-1599] – RSA key format check is too strict
  • [CHEF-1601] – Chef solo should not reset json attributes for each run
  • [CHEF-1605] – spec/unit/provider/service/redhat_spec.rb broken on systems without /sbin/service – false positives when running the test suite
  • [CHEF-1607] – Platform cookbook version detection appears broken
  • [CHEF-1613] – default group provider does not work on Solaris
  • [CHEF-1614] – Use DIETIME/STARTTIME in debian init scripts to give processes time to restart
  • [CHEF-1617] – log provider does not set new_resource.updated flag
  • [CHEF-1632] – Windows mount provider does not assign local drive letter for network shares
  • [CHEF-1639] – Chef can’t load under Rubinius because of a missing io/wait
  • [CHEF-1646] – Spurious 403s on first chef-client run coming from S3 cookbook download
  • [CHEF-1654] – knife ec2 server create fails in bootstrap.rb line 118. undefined method ‘first’
  • [CHEF-1657] – mount provider fails to mount tmpfs
  • [CHEF-1664] – Roles are not properly highligted in the node edit interface.
  • [CHEF-1667] – support amazon linux ami (platform.rb) requires OHAI-216
  • [CHEF-1671] – Bug in the current Apt Package provider – not handling dependencies right
  • [CHEF-1673] – Chef::REST Spec failure, added newline for certificate
  • [CHEF-1728] – Chef does not apply any command line configuration options if it has no config file
  • [CHEF-1739] – Fix manual couchdb replication and organize it so it can be re-used for other projects
  • [CHEF-1741] – Nodes saved without :roles attribute during chef-client run
  • [CHEF-1743] – notifies seem to trigger on cookbook_file even when not run
  • [CHEF-1745] – "Knife (node|role|client|data bag) edit" doesn’t think an object is changed after returning from editor, so doesn’t actually save it
  • [CHEF-1746] – Fix for CHEF-1344 makes chef run incorrectly under runit and upstart
  • [CHEF-1747] – Cookbook version 11.0.0 and such cause troubles
  • [CHEF-1751] – Knife rackspace server create and bootstrap don’t correctly set the ssh password on the underlying knife ssh command
  • [CHEF-1753] – using dot-style in an attributes file results in a NoMethodError

Improvement

  • [CHEF-462] – http_request should allow for setting HTTP Header
  • [CHEF-1137] – knife ssh fails wholesale when one or more hosts are unavailable
  • [CHEF-1442] – Rescue ‘no acceptor’ from thin and re-raise with a clearer error message
  • [CHEF-1520] – Remove the requirement to click the ‘login’ button all the time on the Login screen by enabling ‘default’ behaviour on Enter keypress.
  • [CHEF-1531] – Knife ec2 server create should give the option to specify node name
  • [CHEF-1548] – stack level too deep error appears resolved in json upstream at v1.4.4+
  • [CHEF-1574] – rubygems bootstrap script templates should use rubygems 1.3.7
  • [CHEF-1577] – action :head support for http_request provider
  • [CHEF-1579] – Chef::REST.stream_to_tempfile should only log progress when verbose logging is configured
  • [CHEF-1606] – knife cookbook site vendor <cookbook> fails without cookbook path specified
  • [CHEF-1610] – Refactor Chef::Node::Attribute#method_missing
  • [CHEF-1616] – Chef Solr Indexer should not inflate objects it receives from the queue
  • [CHEF-1675] – Knife status improvements (ip, fqdn, run list)
  • [CHEF-1702] – Ability to pass flags when spawning process from the abstract script provider
  • [CHEF-1709] – Modify cucumber tests to use manual CouchDB replication instead of Couch’s _replicate URL

New Feature

  • [CHEF-1488] – Remote Directory resource should support not overwriting existing files
  • [CHEF-1507] – New resource and provider: ohai (there should be a way to reload ohai data in a recipe)
  • [CHEF-1533] – knife exec – run scripts or snippets of code with chef configured
  • [CHEF-1569] – New knife "windows bootstrap" subcommand
  • [CHEF-1619] – bootstrap template for archlinux (w/ gems)
  • [CHEF-1733] – knife status should take an optional query to limit results

Task

  • [CHEF-1567] – Update mixlib config dependency to the latest
  • [CHEF-1718] – create artifacts for testing apt repository in feature tests