Implement conditional reporting.

This commit is contained in:
Danp2 2016-02-16 06:09:44 -06:00 committed by Julien Fontanet
parent 05c325d686
commit 77f85579e3

View File

@ -60,6 +60,7 @@ class BackupReportsXoPlugin {
async _listener (status) {
let nSuccess = 0
let nCalls = 0
let reportWhen
const text = []
@ -73,6 +74,12 @@ class BackupReportsXoPlugin {
return
}
reportWhen = call.params._reportWhen
if (reportWhen === 'never') {
return
}
let vmStatus
if (call.error) {
@ -114,6 +121,10 @@ class BackupReportsXoPlugin {
const end = moment(status.end)
const duration = moment.duration(end - start).humanize()
if (reportWhen === 'fail' && globalStatus === 'Success') {
return
}
// Global status.
text.unshift([
`## Global status: ${globalStatus}`,