Skip to content
This repository was archived by the owner on Mar 8, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
$full_if_older_than = undef,
$pre_command = undef,
$remove_older_than = undef,
$logfile = undef,
) {

include duplicity::params
Expand Down Expand Up @@ -45,9 +46,19 @@
default => $minute
}

$_logfile = $logfile ? {
undef => $duplicity::params::logfile,
default => $logfile
}

$_croncommand = $_logfile ? {
undef => $spoolfile,
default => "${spoolfile} >>${_logfile} 2>&1"
}

cron { $name :
ensure => $ensure,
command => $spoolfile,
command => $_croncommand,
user => 'root',
minute => $_minute,
hour => $_hour,
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
$full_if_older_than = $duplicity::defaults::full_if_older_than,
$remove_older_than = undef,
$allow_source_mismatch = undef,
$logfile = undef,
$job_spool = $duplicity::defaults::job_spool
) inherits duplicity::defaults {

Expand Down
19 changes: 19 additions & 0 deletions spec/defines/duplicity_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,25 @@
end
end

context "with defined logfile" do
let(:command_with_log) { "#{spoolfile} >>/var/log/duplicity.log 2>&1" }

let(:params) {
{
:bucket => 'somebucket',
:directory => '/etc/',
:dest_id => 'some_id',
:dest_key => 'some_key',
:logfile => '/var/log/duplicity.log'
}
}

it "should be able to handle a specified logfile" do
should contain_cron(title) \
.with_command(command_with_log)
end
end

context 'with duplicity global parameters passed on' do
let(:params) {
{
Expand Down