Code Monkey home page Code Monkey logo

chef-janitor's People

Contributors

nhuff avatar xeon22 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

chef-janitor's Issues

Recursive mode don´t working

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.