aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Fandrich <danf@mageia.org>2024-01-23 17:19:27 -0800
committerDan Fandrich <danf@mageia.org>2024-01-23 17:19:27 -0800
commit57b64d88219d6e7e43e9374fcf59d21acb5b3a4a (patch)
treea5909acc30762bfc450fa5868e83e6127cd6d4f3
parent593ace1786a4e24f1a8130c8d0d8a4bf5bd3e898 (diff)
downloadpuppet-57b64d88219d6e7e43e9374fcf59d21acb5b3a4a.tar
puppet-57b64d88219d6e7e43e9374fcf59d21acb5b3a4a.tar.gz
puppet-57b64d88219d6e7e43e9374fcf59d21acb5b3a4a.tar.bz2
puppet-57b64d88219d6e7e43e9374fcf59d21acb5b3a4a.tar.xz
puppet-57b64d88219d6e7e43e9374fcf59d21acb5b3a4a.zip
Use the config variables for the schedbot cleanup jobs
-rw-r--r--modules/buildsystem/manifests/scheduler.pp41
-rw-r--r--modules/buildsystem/manifests/var/scheduler.pp10
2 files changed, 19 insertions, 32 deletions
diff --git a/modules/buildsystem/manifests/scheduler.pp b/modules/buildsystem/manifests/scheduler.pp
index 11780312..5218b646 100644
--- a/modules/buildsystem/manifests/scheduler.pp
+++ b/modules/buildsystem/manifests/scheduler.pp
@@ -24,47 +24,32 @@ class buildsystem::scheduler {
minute => '*',
}
- if ($buildsystem::var::scheduler::clean_uploads_logs_age != '0') {
-# tidy { "${buildsystem::var::scheduler::homedir}/uploads":
-# type => 'ctime',
-# recurse => true,
-# age => $buildsystem::var::scheduler::clean_uploads_logs_age,
-# rmdirs => true,
-# }
-
+ if ($buildsystem::var::scheduler::clean_uploads_logs_age != 0) {
cron { 'clean uploads logs':
user => $login,
- # TEMPORARY to test what will be deleted before replacing the above
- command => sprintf("/usr/bin/find %s/uploads -xdev -depth -type f -ctime +14 >/var/lib/schedbot/clean-uploads-logs-test.log 2>&1", shellquote($homedir)),
+ # Delete old upload logs
+ command => sprintf("/usr/bin/find %s/uploads -xdev -depth -type f -ctime +%d >/var/lib/schedbot/clean-uploads-logs-test.log 2>&1", shellquote($homedir), shellquote($buildsystem::var::scheduler::clean_uploads_logs_age)),
hour => '*/1',
minute => '51',
}
cron { 'clean uploads dirs':
user => $login,
- # TEMPORARY to test what will be deleted before replacing the above
- # Remove old empty directories. This will take several passes over
- # several weeks to delete a directory hierarchy because it is looking
- # at ctime instead of mtime, which resets every time a file/directory
- # underneath it is deleted. Directories don't take much space, so this
- # shouldn't be a real issue.
- command => sprintf("/usr/bin/find %s/uploads -ignore_readdir_race -mindepth 5 -xdev -depth -type d -ctime +14 -empty >/var/lib/schedbot/clean-uploads-dirs-test.log 2>&1", shellquote($homedir)),
+ # Remove old empty uploads directories. This will take several
+ # passes (over several weeks) to delete a directory hierarchy
+ # because it is looking at ctime instead of mtime, which resets
+ # every time a file/directory underneath it is deleted.
+ # Directories don't take much space, so this shouldn't be a
+ # real issue.
+ command => sprintf("/usr/bin/find %s/uploads -ignore_readdir_race -mindepth 5 -xdev -depth -type d -ctime +%d -empty >/var/lib/schedbot/clean-uploads-dirs-test.log 2>&1", shellquote($homedir), shellquote($buildsystem::var::scheduler::clean_uploads_logs_age)),
hour => '*/1',
minute => '53',
}
}
- if ($buildsystem::var::scheduler::clean_uploads_packages_age != '0') {
-# tidy { "${buildsystem::var::scheduler::homedir}/uploads/**/*.rpm":
-# path => "${buildsystem::var::scheduler::homedir}/uploads",
-# type => 'ctime',
-# recurse => true,
-# age => $buildsystem::var::scheduler::clean_uploads_packages_age,
-# matches => [ '*.rpm' ],
-# }
-
+ if ($buildsystem::var::scheduler::clean_uploads_packages_age != 0) {
cron { 'clean uploads packages':
user => $login,
- # TEMPORARY to test what will be deleted before replacing the above
- command => sprintf("/usr/bin/find %s/uploads -xdev -depth -type f -name '*.rpm' -ctime +7 >/var/lib/schedbot/clean-uploads-packages-test.log 2>&1", shellquote($homedir)),
+ # Delete old upload RPMs
+ command => sprintf("/usr/bin/find %s/uploads -xdev -depth -type f -name '*.rpm' -ctime +%d >/var/lib/schedbot/clean-uploads-packages-test.log 2>&1", shellquote($homedir), shellquote($buildsystem::var::scheduler::clean_uploads_packages_age)),
hour => '*/1',
minute => '52',
}
diff --git a/modules/buildsystem/manifests/var/scheduler.pp b/modules/buildsystem/manifests/var/scheduler.pp
index 22681726..b431594c 100644
--- a/modules/buildsystem/manifests/var/scheduler.pp
+++ b/modules/buildsystem/manifests/var/scheduler.pp
@@ -10,18 +10,20 @@
# $build_src_node:
# hostname of the server building the initial src.rpm
# $clean_uploads_logs_age:
-# old logs are cleaned when they are older than some amount of time.
+# old logs are cleaned when they are older than some amount of days.
# You can define this amount of time using this variable. Set it to
-# '2w' for two weeks, '2d' for two days, or '0' if you don't want to
+# 14 for two weeks, 2 for two days, or 0 if you don't want to
# clean old logs at all
+# $clean_uploads_packages_age:
+# same as $clean_uploads_logs_age but for old RPMs
class buildsystem::var::scheduler(
$admin_mail = "root@${::domain}",
$pkg_uphost = "pkgsubmit.${::domain}",
$build_nodes,
$build_nodes_aliases = {},
$build_src_node,
- $clean_uploads_logs_age = '2w',
- $clean_uploads_packages_age = '1w'
+ $clean_uploads_logs_age = 14,
+ $clean_uploads_packages_age = 7
){
$login = 'schedbot'
$homedir = "/var/lib/${login}"