xeon22 / chef-janitor Goto Github PK
View Code? Open in Web Editor NEWchef-janitor cookbook
License: Apache License 2.0
chef-janitor cookbook
License: Apache License 2.0
Hi, I have tested this cookbook, but the recursive mode don´t works on my recipe, ie, using no other type of parameter in the resource beyond the size, did not erase the contents of the subdirectory.
My testing:
Create a subdir /tmp/test and a lots of fake files in it:
mkdir -p /tmp/test
dd if=/dev/zero of=/tmp/test_file bs=1M count=30
dd if=/dev/zero of=/tmp/test_file bs=1M count=3000
dd if=/dev/zero of=/tmp/test/test_file bs=1M count=3000
dd if=/dev/zero of=/tmp/test/test_file2 bs=1M count=300
dd if=/dev/zero of=/tmp/test/test_file3 bs=1M count=300
dd if=/dev/zero of=/tmp/test/test_file4 bs=1M count=500
dd if=/dev/zero of=/tmp/test/test_file5 bs=1M count=980
My Test folder:
[vagrant@centera-sdk-bento-centos-73 ~]$ df -hP /tmp/test
Sist. Arq. Tam. Usado Disp. Uso% Montado em
/dev/mapper/cl-root 37G 9,4G 28G 26% /
[vagrant@centera-sdk-bento-centos-73 ~]$ ls -latrh /tmp/test
total 5,0G
-rwxr-xr-x. 1 vagrant vagrant 29K Jan 16 17:16 FPLibrary.jar
-rwxr-xr-x. 1 vagrant vagrant 409 Jan 16 17:16 test2.yml
drwxrwxrwt. 10 root root 184 Jan 16 17:22 ..
-rw-rw-r--. 1 vagrant vagrant 3,0G Jan 16 17:32 test_file
-rw-rw-r--. 1 vagrant vagrant 300M Jan 16 17:32 test_file2
-rw-rw-r--. 1 vagrant vagrant 300M Jan 16 17:32 test_file3
-rw-rw-r--. 1 vagrant vagrant 500M Jan 16 17:32 test_file4
drwxr-xr-x. 2 vagrant vagrant 133 Jan 16 17:33 .
-rw-rw-r--. 1 vagrant vagrant 980M Jan 16 17:33 test_file5
[vagrant@centera-sdk-bento-centos-73 ~]$
In my recipe (as it is in the README.md
)
janitor_sweep '/tmp/' do
size '30M'
recursive true
action :purge
end
When I converge my cookbook:
Converging 4 resources
Recipe: prbbr-ops-limpeza-fs::default
* yum_package[ntp] action install (up to date)
* execute[timezone] action run
- execute timedatectl set-timezone America/Sao_Paulo
* execute[bkp_tz] action run (skipped due to only_if)
* janitor_sweep[/tmp/] action purge
Recipe: <Dynamically Defined Resource>
* file[/tmp/test_file] action delete
- delete file /tmp/test_file
- delete /tmp/test_file => 2018-01-16 3000.0 MB
Running handlers:
Running handlers complete
Chef Client finished, 3/5 resources updated in 18 seconds
Finished converging <centera-sdk-bento-centos-73> (0m26.04s).
-----> Kitchen is finished. (0m27.49s)
In the FileSystem:
Last login: Tue Jan 16 17:35:18 2018 from 192.168.121.1
[vagrant@centera-sdk-bento-centos-73 ~]$ ls -latrh /tmp/test
total 5,0G
-rwxr-xr-x. 1 vagrant vagrant 29K Jan 16 17:16 FPLibrary.jar
-rwxr-xr-x. 1 vagrant vagrant 409 Jan 16 17:16 test2.yml
-rw-rw-r--. 1 vagrant vagrant 3,0G Jan 16 17:32 test_file
-rw-rw-r--. 1 vagrant vagrant 300M Jan 16 17:32 test_file2
-rw-rw-r--. 1 vagrant vagrant 300M Jan 16 17:32 test_file3
-rw-rw-r--. 1 vagrant vagrant 500M Jan 16 17:32 test_file4
drwxr-xr-x. 2 vagrant vagrant 133 Jan 16 17:33 .
-rw-rw-r--. 1 vagrant vagrant 980M Jan 16 17:33 test_file5
drwxrwxrwt. 10 root root 167 Jan 16 17:36 ..
[vagrant@centera-sdk-bento-centos-73 ~]$
Thaks a Lot!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.