Quote command output strings passed to logging functions.

Thanks to @Gackiewicz for the report!

Closes #11278
This commit is contained in:
intrigeri 2018-01-10 10:43:36 +00:00
parent 62218c4cf1
commit e0b4375400
7 changed files with 38 additions and 38 deletions

View File

@ -314,10 +314,10 @@ if [ ! $test ]; then
"$execstr_precmd duplicity cleanup --force $execstr_options $execstr_serverpart 2>&1"`
exit_code=$?
if [ $exit_code -eq 0 ]; then
debug $output
debug "$output"
info "Duplicity cleanup finished successfully."
else
debug $output
debug "$output"
warning "Duplicity cleanup failed."
fi
fi
@ -334,10 +334,10 @@ if [ "$keep" != "yes" ]; then
"$execstr_precmd duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart 2>&1"`
exit_code=$?
if [ $exit_code -eq 0 ]; then
debug $output
debug "$output"
info "Duplicity remove-older-than finished successfully."
else
debug $output
debug "$output"
warning "Duplicity remove-older-than failed."
fi
fi
@ -357,10 +357,10 @@ if [ "$keep" != "yes" ]; then
"$execstr_precmd duplicity remove-all-inc-of-but-n-full $keepincroffulls --force $execstr_options $execstr_serverpart 2>&1"`
exit_code=$?
if [ $exit_code -eq 0 ]; then
debug $output
debug "$output"
info "Duplicity remove-all-inc-of-but-n-full finished successfully."
else
debug $output
debug "$output"
warning "Duplicity remove-all-inc-of-but-n-full failed."
fi
fi
@ -379,12 +379,12 @@ if [ ! $test ]; then
su -c \
"$execstr_precmd duplicity $execstr_command $execstr_options $execstr_source --exclude '**' / $execstr_serverpart >$outputfile 2>&1"`
exit_code=$?
debug $output
debug "$output"
cat $outputfile | (while read output ; do
if [ $exit_code -eq 0 ]; then
info $output
info "$output"
else
error $output
error "$output"
fi
done
)

View File

@ -94,10 +94,10 @@ if [ "$ldif" == "yes" ]; then
output=`su root -s /bin/bash -c "set -o pipefail ; $execstr" 2>&1`
code=$?
if [ "$code" == "0" ]; then
debug $output
debug "$output"
info "Successfully finished ldif export of $dbsuffix"
else
warning $output
warning "$output"
warning "Failed ldif export of $dbsuffix"
fi

View File

@ -51,10 +51,10 @@ debug 0 "echo $execstr "
output=` $execstr 2>&1 `
code=$?
if [ "$code" == "0" ]; then
debug $output
debug "$output"
info "Successfully finished creation of iso"
else
warning $output
warning "$output"
warning "Failed to create iso"
fi
@ -65,10 +65,10 @@ if [ "$isoonly" == "no" ]; then
$CDRECORD -v gracetime=2 dev=$device speed=8 -dao -data $outputfile
code=$?
if [ "$code" == "0" ]; then
debug $output
debug "$output"
info "Successfully burned CD"
else
warning $output
warning "$output"
warning "Failed to create CD"
fi
fi
@ -77,10 +77,10 @@ if [ "$isoonly" == "no" ]; then
$GROWISOFS -speed=2 -Z $device=$outputfile -use-the-force-luke=notray -use-the-force-luke=tty
code=$?
if [ "$code" == "0" ]; then
debug $output
debug "$output"
info "Successfully burned DVD"
else
warning $output
warning "$output"
warning "Failed to create DVD"
fi
fi

View File

@ -194,10 +194,10 @@ then
code=$?
if [ "$code" == "0" ]
then
debug $output
debug "$output"
info "Successfully finished hotcopy of all mysql databases"
else
warning $output
warning "$output"
warning "Failed to hotcopy all mysql databases"
fi
fi
@ -217,10 +217,10 @@ then
code=$?
if [ "$code" == "0" ]
then
debug $output
debug "$output"
info "Successfully finished hotcopy of mysql database $db"
else
warning $output
warning "$output"
warning "Failed to hotcopy mysql database $db"
fi
fi
@ -303,10 +303,10 @@ then
code=$?
if [ "$code" == "0" ]
then
debug $output
debug "$output"
info "Successfully finished dump of mysql database $db"
else
warning $output
warning "$output"
warning "Failed to dump mysql databases $db"
fi
fi

View File

@ -131,10 +131,10 @@ if [ "$databases" == "all" ]; then
output=`eval $execstr 2>&1`
code=$?
if [ "$code" == "0" ]; then
debug $output
debug "$output"
info "Successfully finished dump of pgsql cluster"
else
warning $output
warning "$output"
warning "Failed to dump pgsql cluster"
fi
fi
@ -161,10 +161,10 @@ else
output=`eval $execstr 2>&1`
code=$?
if [ "$code" == "0" ]; then
debug $output
debug "$output"
info "Successfully finished pgsql globals (roles and tablespaces) dump"
else
warning $output
warning "$output"
warning "Failed to dump pgsql globals (roles and tablespaces)"
fi
fi
@ -198,10 +198,10 @@ else
output=`eval $execstr 2>&1`
code=$?
if [ "$code" == "0" ]; then
debug $output
debug "$output"
info "Successfully finished dump of pgsql database ${db}"
else
warning $output
warning "$output"
warning "Failed to dump pgsql database ${db}"
fi
fi

View File

@ -184,13 +184,13 @@ if [ "$keep" != yes ]; then
output="`su -c "$removestr" 2>&1`"
if [ $? = 0 ]; then
if [ "$output_as_info" == "yes" ]; then
info $output
info "$output"
else
debug $output
debug "$output"
fi
info "Removing backups older than $keep days succeeded."
else
warning $output
warning "$output"
warning "Failed removing backups older than $keep."
fi
fi
@ -274,13 +274,13 @@ if [ $test = 0 ]; then
output=`nice -n $nicelevel su -c "$execstr" 2>&1`
if [ $? = 0 ]; then
if [ "$output_as_info" == "yes" ]; then
info $output
info "$output"
else
debug $output
debug "$output"
fi
info "Successfully finished backing up source $label"
else
error $output
error "$output"
fatal "Failed backup up source $label"
fi
fi

View File

@ -664,10 +664,10 @@ if [ "$luksheaders" == "yes" ]; then
output=`$DD if="${dev}" of="${outputfile}" bs=512 count="${headersize}" 2>&1`
exit_code=$?
if [ $exit_code -eq 0 ]; then
debug $output
debug "$output"
info "The LUKS header of $dev was saved to $outputfile."
else
debug $output
debug "$output"
fatal "The LUKS header of $dev could not be saved."
fi
done
@ -720,7 +720,7 @@ function doLvmBackup () {
output=`$VGCFGBACKUP --file "${lvmdir}"/'%s' $vg`
done
exit_code=$?
debug $output
debug "$output"
case $exit_code in
0)
info "LVM metadata was saved to $lvmdir for volume groups: $vgs"