Skip to content

knife plugin to help cleanup unused cookbook versions from a chef server.

License

Notifications You must be signed in to change notification settings

soundcloud/knife-cleanup

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Knife-Cleanup

This is a Knife plugin to help cleanup unused cookbook versions from a chef server. If you have an automated system that creates new cookbook versions for each commit (maybe something like chef-jenkins) then your chef server might end up with thousands of cookbook versions and they most of them are unused. And this is perfectly fine... Still if this annoys you, this plugin will help you cleanup unused versions by looking into each environment and keeping the versions used there and also the latest version of each cookbook. Before deleting any cookbooks it will download and create a backup of them under .cleanup/cookbook_name/.

Installation

You will need chef installed and a working knife config; development has been done on chef 11, but it should work with any version higher than 0.10.10

gem install knife-cleanup

Usage

For a list of commands:

knife cleanup --help

Currently there is only one command available:

knife cleanup versions <-D>

If you run it without --delete (-D) it will show you the versions that would be deleted, but not delete anything. In delete mode it will save first a backup of the version and then proceed to delete it. I've seen various strange situations where knife is not able to download the cookbook version from the server, and be aware that we will skip those cases and there will not be a backup for such corrupted versions. You've been warned.

Note: this is by no means production ready; I'm using it with success for my needs and hopefully you will find it useful too. Be sure to do a backup your chef server (knife-backup before using it, etc.

Todo/Ideas

  • Make backup optional and location of them configurable
  • Cleanup databags
  • Cleanup unused cookbooks

Development

Pull requests are very welcome! Ideally create a topic branch for every separate change you make. For example:

  1. Fork the repo
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Authors

Created and maintained by Marius Ducea ([email protected])

License

Apache License, Version 2.0 (see LICENSE)

About

knife plugin to help cleanup unused cookbook versions from a chef server.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%