cookbook 'janitor', '~> 2.0.1'
janitor (6) Versions 2.0.1 Follow2
A General Cookbook used to cleanup files and directories on nodes
cookbook 'janitor', '~> 2.0.1', :supermarket
knife supermarket install janitor
knife supermarket download janitor
Description
This cookbook is meant to keep order on a running node to purge files
on the filesystem that are unwanted. You could also apply some criteria to the files
that are targeted such as regular expressions, age, and size.
Requirements
Chef, Linux
Platform:
- redhat
- centos
- ubuntu
- debian
- macos
- Good possibility it will work in windows as all path references have been abstracted. (Not tested)
Cookbooks:
No cookbooks defined
Resources
janitor_directory
Actions
- purge: Default action.
Attribute Parameters
janitor_directory
path
- Resource name or path parameter will pass the path to be examined to the lwrp.-
include_only
- Array of regular expressions that are applied to the list of files present in
path
. - This will eliminate all entries except for those matching the regular expressions.
- Defaults to
nil
.
- Array of regular expressions that are applied to the list of files present in
-
exclude_all
- Array of regular expressions that are applied to the list of files present in
path
. - This will eliminate all entries matching the regular expressions.
- Defaults to
nil
.
- Array of regular expressions that are applied to the list of files present in
-
age
- Files older thanage
(in days) will be deleted.- Defaults to
nil
.
- Defaults to
-
size
- Files larger than thesize
(in b,M,G,T,P) will be deleted.- Defaults to
nil
.
- Defaults to
-
directory_size
- Old files are removed until directory is at or below given size- Defaults to
nil
.
- Defaults to
-
recursive
- enable recursive searching from the path indicated in the resource- Defaults to
false
- Defaults to
Examples
# Delete all files in /var/log with the .gz extension
janitor_directory "/var/log" do
include_only [/.*\.gz$]
action :purge
end
# Delete all files in /var/log with the .gz and numeric extension
janitor_directory "/var/log" do
include_only [/.*\.gz$/,/.*\.\d/]
action :purge
end
# Delete all files in /var/log (recusively) with the .gz and numeric extension
# And are also larger than 10M and older than 30 days
janitor_directory "/var/log" do
include_only [/.*\.gz$/,/.*\.\d/]
age 30
size "10M"
recursive true
action :purge
end
# Delete old files fom /var/log until directory is below 2G
janitor_directory "/var/log" do
directory_size "2G"
action :purge
end
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
Collaborator Number Metric
2.0.1 failed this metric
Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
2.0.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
2.0.1 failed this metric
FC064: Ensure issues_url is set in metadata: janitor/metadata.rb:1
FC065: Ensure source_url is set in metadata: janitor/metadata.rb:1
FC066: Ensure chef_version is set in metadata: janitor/metadata.rb:1
FC069: Ensure standardized license defined in metadata: janitor/metadata.rb:1
FC070: Ensure supports metadata defines valid platforms: janitor/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
2.0.1 passed this metric
Testing File Metric
2.0.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
2.0.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
2.0.1 failed this metric
2.0.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
2.0.1 failed this metric
FC064: Ensure issues_url is set in metadata: janitor/metadata.rb:1
FC065: Ensure source_url is set in metadata: janitor/metadata.rb:1
FC066: Ensure chef_version is set in metadata: janitor/metadata.rb:1
FC069: Ensure standardized license defined in metadata: janitor/metadata.rb:1
FC070: Ensure supports metadata defines valid platforms: janitor/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
2.0.1 passed this metric
Testing File Metric
2.0.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
2.0.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
2.0.1 failed this metric
FC065: Ensure source_url is set in metadata: janitor/metadata.rb:1
FC066: Ensure chef_version is set in metadata: janitor/metadata.rb:1
FC069: Ensure standardized license defined in metadata: janitor/metadata.rb:1
FC070: Ensure supports metadata defines valid platforms: janitor/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
2.0.1 passed this metric
Testing File Metric
2.0.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
2.0.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
2.0.1 failed this metric
2.0.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number