Skip to content

Commit e7095f8

Browse files
authored
Merge pull request #186 from bastelfreak/set
Run backup create with set +e if pruning is enabled
2 parents 1e1904b + fb7c14d commit e7095f8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

spec/classes/init_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
it { is_expected.to contain_file('/etc/borg') }
2626
it { is_expected.to contain_file('/etc/profile.d/borg.sh') }
27-
it { is_expected.to contain_file('/usr/local/bin/borg-backup') }
27+
it { is_expected.to contain_file('/usr/local/bin/borg-backup').with_content(%r{borg create.*" \|\| true}) }
2828
it { is_expected.to contain_file('/usr/local/bin/borg_exporter') }
2929
it { is_expected.to contain_file('/etc/borg-restore.cfg') }
3030
it { is_expected.to contain_class('borg::install') }
@@ -190,7 +190,7 @@
190190
}
191191
end
192192

193-
it { is_expected.not_to contain_file('/usr/local/bin/borg-backup').with_content(%r{/^\s+borg prune/}) }
193+
it { is_expected.to contain_file('/usr/local/bin/borg-backup').without_content(%r{/^\s+borg prune/}).without_content(%r{borg create.*" \|\| true}) }
194194
end
195195

196196
context 'with absolute backup destination dir present' do

templates/borg-backup.sh.epp

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ backup_borg() {
180180
# Change the working directory in case the source paths are relative
181181
cd "<%= $working_directory %>"
182182

183-
borg create "${options[@]}" --stats --verbose "$dst::backup-$(date "+%Y%m%d-%H%M%S")" "${src[@]}"
183+
borg create "${options[@]}" --stats --verbose "$dst::backup-$(date "+%Y%m%d-%H%M%S")" "${src[@]}"<% if $manage_prune { %> || true<% } %>
184184
<% if $manage_prune { -%>
185185
# keep all backups from the last <%= $keep_within %> days
186186
# keep at least one backup for each day for <%= $keep_daily %> days

0 commit comments

Comments
 (0)