Simple chef handler to remove files who was not updated by chef in the specific directory.
Tested on Ubuntu 12.04, but may work on almost all linux platforms.
Include chef_cleaner in your node's run_list:
{
"run_list": [
"recipe[chef_cleaner::default]"
]
}For starting cleaning in directory use chef_cleaner resource:
chef_cleaner"/tmp/1"There is additional attributes:
- recursive - For recursive check files in dir. Default: false (TrueFalse)
- exclude - Array of exclude files in dir (May be Regexp or local path or global path) (String or Regexp or Array)
- report - for testing, if you not sure what you want to clean. Default: false (TrueFalse)
- notify - run some command if cleaner remove some files (String or Array)
Actions:
- :make_clean - Default action
- :report - Make report, not remove files
Examples:
chef_cleaner"/etc/sensu/conf.d/checks"doexclude"my_new_check.json"notify"\`service sensu-client restart\`"endchef_cleaner"/etc/nginx/site-enables"dorecursivetrueaction:reportendchef_cleaner"Custom name"dodirectory"/tmp/test_directory_7"recursivetrueexclude[/.*regexp$/,"subdir_created_with_bash/created_with_bash","/subdir_created_with_chef/created_with_bash","/tmp/test_directory_7/subdir_created_with_bash/created_with_bash_other"]end- Modify test.rb recipe
- Just run
vagrant up
- Fork the repository on Github
- Create a named feature branch (i.e.
add-new-recipe) - Write you change
- Write tests for your change (if applicable)
- Run the tests, ensuring they all pass
- Submit a Pull Request
Author:: Grammarly, Inc. (ctrlok@gmail.com)