mirror of
https://0xacab.org/liberate/backupninja.git
synced 2024-11-22 10:42:30 +01:00
add reportwrap config parameter
set to wrap at 1000 columns by default to avoid MTA rejection allowed by SMTP RFC2821
This commit is contained in:
parent
76b457cc4d
commit
ede337dbcd
@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- [core] implement reportwrap configuration parameter
|
||||
|
||||
### Changed
|
||||
|
||||
- [core] raise error if mail isn't found in $PATH and reportemail = yes
|
||||
@ -16,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- [build] make build reproducible regardless of usrmerge (DEBBUG-915222)
|
||||
- [core] silence exit code message unless --debug is used
|
||||
- [core] backup halt should trigger email report if enabled
|
||||
- [core] wrap report email body to 1000 characters by default (DEBBUG-871793)
|
||||
|
||||
## [1.2.0] - 2021-01-21
|
||||
|
||||
|
@ -46,6 +46,9 @@ reportuser = ninja
|
||||
# use a globally unique name, preferably the hostname
|
||||
reportdirectory = /var/lib/backupninja/reports
|
||||
|
||||
# number of columns the report email body should wrap to
|
||||
#reportwrap = 80
|
||||
|
||||
# set to the administration group that is allowed to
|
||||
# read/write configuration files in /etc/backup.d
|
||||
admingroup = root
|
||||
|
@ -54,6 +54,10 @@ If set to 'yes', a report email will be generated even if all modules reported s
|
||||
.B reportwarning
|
||||
If set to 'yes', a report email will be generated even if there was no error.
|
||||
|
||||
.TP
|
||||
.B reportwrap
|
||||
Number of columns the email report body should wrap to.
|
||||
|
||||
.TP
|
||||
.B logfile
|
||||
The path of the logfile.
|
||||
@ -107,6 +111,8 @@ reportsuccess = yes
|
||||
.br
|
||||
reportwarning = yes
|
||||
.br
|
||||
reportwrap = 1000
|
||||
.br
|
||||
logfile = /var/log/backupninja.log
|
||||
.br
|
||||
configdirectory = /etc/backup.d
|
||||
|
@ -543,6 +543,7 @@ getconf RSYNC /usr/bin/rsync
|
||||
getconf DSYNC /usr/bin/dsync
|
||||
getconf DOVEADM /usr/bin/doveadm
|
||||
getconf admingroup root
|
||||
getconf reportwrap 1000
|
||||
|
||||
if [ ! -d "$configdirectory" ]; then
|
||||
echo "Configuration directory '$configdirectory' not found."
|
||||
@ -636,7 +637,7 @@ if [ $doit == 1 ]; then
|
||||
fi
|
||||
done
|
||||
fi
|
||||
} | mail -s "backupninja: $hostname $subject" $reportemail
|
||||
} | fold -s -w "$reportwrap" | mail -s "backupninja: $hostname $subject" $reportemail
|
||||
else
|
||||
error "Unable to locate mail executable, email report not sent!"
|
||||
let "errors += 1"
|
||||
|
@ -128,7 +128,25 @@ create_test_action() {
|
||||
mv /usr/bin/mail /usr/bin/mail.moved
|
||||
run backupninja --now -f "${BATS_TMPDIR}/backupninja.conf" --run "${BATS_TMPDIR}/backup.d/test.sh"
|
||||
[ "$status" -eq 1 ]
|
||||
false
|
||||
}
|
||||
|
||||
@test "reports: wraps report text to 1000 columns by default" {
|
||||
create_test_action info "$(printf \'=%.0s\' {1..2000})"
|
||||
setconfig backupninja.conf reportsuccess yes
|
||||
setconfig backupninja.conf reportinfo yes
|
||||
run backupninja --now -f "${BATS_TMPDIR}/backupninja.conf" --run "${BATS_TMPDIR}/backup.d/test.sh"
|
||||
sleep 0.1
|
||||
grep -q '^=\{1000\}$' /var/mail/vagrant
|
||||
}
|
||||
|
||||
@test "reports: wraps report text according to reportwrap" {
|
||||
create_test_action info "$(printf \'=%.0s\' {1..2000})"
|
||||
setconfig backupninja.conf reportsuccess yes
|
||||
setconfig backupninja.conf reportinfo yes
|
||||
setconfig backupninja.conf reportwrap 100
|
||||
run backupninja --now -f "${BATS_TMPDIR}/backupninja.conf" --run "${BATS_TMPDIR}/backup.d/test.sh"
|
||||
sleep 0.1
|
||||
grep -q '^=\{100\}$' /var/mail/vagrant
|
||||
}
|
||||
|
||||
@test "scheduling: runs when = 'everyday at 01' and time matches" {
|
||||
|
Loading…
Reference in New Issue
Block a user