aboutsummaryrefslogtreecommitdiffstats
path: root/modules/mirror_cleaner/manifests
diff options
context:
space:
mode:
authorMichael Scherer <misc@mageia.org>2011-07-19 01:14:54 +0000
committerMichael Scherer <misc@mageia.org>2011-07-19 01:14:54 +0000
commitbe91201208f86bdb6b042613a498fd16585acfba (patch)
tree3a55c7b96fb59bffcd1c45e2d1b665e09f2ef582 /modules/mirror_cleaner/manifests
parent2a69c0738d2a174ffbb326a9e1464e54f99a0758 (diff)
downloadpuppet-be91201208f86bdb6b042613a498fd16585acfba.tar
puppet-be91201208f86bdb6b042613a498fd16585acfba.tar.gz
puppet-be91201208f86bdb6b042613a498fd16585acfba.tar.bz2
puppet-be91201208f86bdb6b042613a498fd16585acfba.tar.xz
puppet-be91201208f86bdb6b042613a498fd16585acfba.zip
add a module to clean orphan, as discussed on the ml :
- move rpm without a corresponding src.rpm to a directory after 2 weeks - remove files after 1 month
Diffstat (limited to 'modules/mirror_cleaner/manifests')
-rw-r--r--modules/mirror_cleaner/manifests/init.pp34
1 files changed, 34 insertions, 0 deletions
diff --git a/modules/mirror_cleaner/manifests/init.pp b/modules/mirror_cleaner/manifests/init.pp
new file mode 100644
index 00000000..1db1e922
--- /dev/null
+++ b/modules/mirror_cleaner/manifests/init.pp
@@ -0,0 +1,34 @@
+class mirror_cleaner {
+ class base {
+ file { "/usr/local/bin/orphans_cleaner.pl":
+ ensure => present,
+ owner => root,
+ group => root,
+ mode => 755,
+ source => 'puppet:///modules/mirror_cleaner/orphans_cleaner.pl',
+ }
+ }
+
+ define orphans($base) {
+ include mirror_cleaner::base
+
+ $orphan_dir = "$base/$name"
+
+ file { $orphan_dir:
+ ensure => directory
+ }
+
+ cron { "clean orphans $name":
+ command => "/usr/local/bin/orphans_cleaner.pl $base/$name $orphan_dir",
+ hour => 5,
+ minute => 30,
+ user => root,
+ }
+
+ tidy { $orphan_dir:
+ age => "4w",
+ recurse => true,
+ matches => ["*.rpm"],
+ }
+ }
+}