From fc58aacc31f985a2ee4f1dfe9455bda74aca5942 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Wed, 25 Sep 2019 11:00:15 +0200 Subject: [PATCH] Pass pool-name token to volumes-delete-old --- modules/bacula/files/volumes-delete-old | 5 ++++- modules/bacula/manifests/director.pp | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/bacula/files/volumes-delete-old b/modules/bacula/files/volumes-delete-old index 80f2c935b..979e46929 100755 --- a/modules/bacula/files/volumes-delete-old +++ b/modules/bacula/files/volumes-delete-old @@ -49,6 +49,9 @@ parser.add_argument("-v", "--verbose", dest="verbose", parser.add_argument("-n", "--nodo", dest="nodo", default=False, action="store_true", help="Print to cat rather than bconsole.") +parser.add_argument("-t", "--token", metavar='TOKEN', dest="pool_name_token", + default='bacula', + help="A string token used in pool names.") args = parser.parse_args() if args.db is not None: @@ -130,7 +133,7 @@ if os.path.exists(args.clientlist): for r in cursor.fetchall(): poolname = r['name'] - match = re.match('pool[a-z]*-debian-(.*)', poolname) + match = re.match('pool[a-z]*-%s-(.*)'%(args.pool_name_token, ), poolname) if match is not None: hostname = match.group(1) if hostname not in clients: diff --git a/modules/bacula/manifests/director.pp b/modules/bacula/manifests/director.pp index f5d54f917..5f7fba43c 100644 --- a/modules/bacula/manifests/director.pp +++ b/modules/bacula/manifests/director.pp @@ -136,10 +136,10 @@ class bacula::director( file { '/etc/cron.d/puppet-bacula-stuff': ensure => absent, } concat::fragment { 'puppet-crontab--bacula-director': target => '/etc/cron.d/puppet-crontab', - content => @(EOF) + content => @("EOF"/$) @daily root chronic /etc/bacula/scripts/volume-purge-action -v - @daily root chronic /etc/bacula/scripts/volumes-delete-old -v - */3 * * * * root sleep $(( $RANDOM \% 60 )); flock -w 0 -e /usr/local/sbin/dsa-bacula-scheduler /usr/local/sbin/dsa-bacula-scheduler + @daily root chronic /etc/bacula/scripts/volumes-delete-old -v --token '${pool_name}' + */3 * * * * root sleep $(( \$RANDOM \\% 60 )); flock -w 0 -e /usr/local/sbin/dsa-bacula-scheduler /usr/local/sbin/dsa-bacula-scheduler | EOF } -- 2.20.1