Knife-essentials 0.9.7 released ("edit" and "xargs")


To install:

gem install knife-essentials

Knife-essentials contains the latest version of the knife download, upload, diff, deps, list, show, delete, edit, xargs and raw commands.

This particular release of knife-essentials includes the new tools “knife edit” and “knife xargs”:

knife edit: lets you edit any sort of object

knife edit roles/base.json environments/desert.json
<brings up your editor on each matching file, and uploads it if it is changed>

knife xargs: a powerful bulk read/edit command that passes Chef objects through a program

To look for all nodes with attributes named foo or values containing foo:
knife list /nodes/* | knife xargs -n 40 grep foo

To replace “foo” with “bar” in all roles on the server:
knife list roles/* | knife xargs – sed -i ‘s/foo/bar’

–John Keiser (@jkeiser2)