Skip to content
Snippets Groups Projects
Commit 25c3a9f4 authored by Jérôme Charaoui's avatar Jérôme Charaoui
Browse files

improve error handling around reporthost feature

parent f6870a61
Branches
Tags
No related merge requests found
...@@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [core] silence exit code message unless --debug is used - [core] silence exit code message unless --debug is used
- [core] backup halt should trigger email report if enabled - [core] backup halt should trigger email report if enabled
- [core] wrap report email body to 1000 characters by default (DEBBUG-871793) - [core] wrap report email body to 1000 characters by default (DEBBUG-871793)
- [core] improve error handling around reporthost feature
## [1.2.0] - 2021-01-21 ## [1.2.0] - 2021-01-21
......
...@@ -652,8 +652,24 @@ if [ $actions_run != 0 ]; then ...@@ -652,8 +652,24 @@ if [ $actions_run != 0 ]; then
fi fi
if [ -n "$reporthost" ]; then if [ -n "$reporthost" ]; then
debug "send $logfile to $reportuser@$reporthost:$reportdirectory" if [ -z "$reportuser" ] || [ -z "$reportdirectory" ]; then
rsync -qt $logfile $reportuser@$reporthost:$reportdirectory error "Unable to send report, reportuser and reportdirectory must be specified."
let "errors += 1"
elif [ ! -x "$(which rsync 2>/dev/null)" ]; then
error "Unable to locate rsync executable, report could not be sent to ${reporthost}."
let "errors += 1"
else
info "Sending $logfile to $reportuser@$reporthost:$reportdirectory"
execstr="rsync -qt $logfile $reportuser@$reporthost:$reportdirectory"
debug $execstr
output=$(eval $execstr 2>&1)
ret=$?
if [ $ret -ne 0 ]; then
error $output
error "An error was encountered attempting to send report to ${reporthost}."
let "errors += 1"
fi
fi
fi fi
# return exit code # return exit code
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment