Skip to content

Commit f392400

Browse files
committed
(FIX) Switch DLO to Puppet cron from cron::job
1 parent 4e4e81a commit f392400

3 files changed

Lines changed: 9 additions & 11 deletions

File tree

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -687,10 +687,9 @@ cronjob. The variable configures the systemd.timer option [onCalender](https://w
687687
It defaults to `*-*-* ${fqdn_rand(24)}:${fqdn_rand(60)}:00`. This will start
688688
the cleanup service on a daily basis. The exact minute and hour is random
689689
per node based on the [fqdn_rand](https://puppet.com/docs/puppet/5.5/function.html#fqdnrand)
690-
method. On non-systemd systems, the cron runs daily and you need the
691-
[puppet/cron](https://forge.puppet.com/puppet/cron) module. On systemd systems
692-
you need the [camptocamp/systemd](https://forge.puppet.com/camptocamp/systemd)
693-
module. Both are optional dependencies and not automatically installed!
690+
method. On non-systemd systems, the cron runs daily and the `$puppetdb_user` needs
691+
to be able to run cron jobs. On systemd systems you need the [camptocamp/systemd](https://forge.puppet.com/camptocamp/systemd)
692+
module, which is an optional dependency and not automatically installed!
694693

695694
#### `dlo_max_age`
696695

manifests/server.pp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,16 +304,15 @@
304304
active => true,
305305
}
306306
} else {
307-
cron::job{'puppetdb-dlo-cleanup':
307+
cron { 'puppetdb-dlo-cleanup':
308308
ensure => 'present',
309309
minute => fqdn_rand(60),
310310
hour => fqdn_rand(24),
311-
date => '*',
311+
monthday => '*',
312312
month => '*',
313313
weekday => '*',
314314
command => "/usr/bin/find /opt/puppetlabs/server/data/puppetdb/stockpile/discard/ -type f -mtime ${dlo_max_age} -delete",
315315
user => $puppetdb_user,
316-
description => 'Cleanup old discarded puppetdb reports',
317316
}
318317
}
319318
}

spec/unit/classes/server_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
it { is_expected.to contain_systemd__unit_file('puppetdb-dlo-cleanup.service') }
9090
it { is_expected.to contain_systemd__unit_file('puppetdb-dlo-cleanup.timer').with_enable(true).with_active(true) }
9191

92-
it { is_expected.not_to contain_cron__job('puppetdb-dlo-cleanup') }
92+
it { is_expected.not_to contain_cron('puppetdb-dlo-cleanup') }
9393
end
9494

9595
describe 'dlo cleanup service can be disabled by params' do
@@ -101,13 +101,13 @@
101101

102102
it { is_expected.not_to contain_systemd__unit_file('puppetdb-dlo-cleanup.service') }
103103
it { is_expected.not_to contain_systemd__unit_file('puppetdb-dlo-cleanup.timer') }
104-
it { is_expected.not_to contain_cron__job('puppetdb-dlo-cleanup') }
104+
it { is_expected.not_to contain_cron('puppetdb-dlo-cleanup') }
105105
end
106106
end
107107

108108
context 'when systemd is not available' do
109109
describe 'by default dlo cleanup is set up with cron' do
110-
it { is_expected.to contain_cron__job('puppetdb-dlo-cleanup').with_ensure('present') }
110+
it { is_expected.to contain_cron('puppetdb-dlo-cleanup').with_ensure('present') }
111111

112112
it { is_expected.not_to contain_systemd__unit_file('puppetdb-dlo-cleanup.service') }
113113
it { is_expected.not_to contain_systemd__unit_file('puppetdb-dlo-cleanup.timer') }
@@ -122,7 +122,7 @@
122122

123123
it { is_expected.not_to contain_systemd__unit_file('puppetdb-dlo-cleanup.service') }
124124
it { is_expected.not_to contain_systemd__unit_file('puppetdb-dlo-cleanup.timer') }
125-
it { is_expected.not_to contain_cron__job('puppetdb-dlo-cleanup') }
125+
it { is_expected.not_to contain_cron('puppetdb-dlo-cleanup') }
126126
end
127127
end
128128
end

0 commit comments

Comments
 (0)