Merge pull request #8 from vatesfr/conditional-reporting

Implement conditional reporting.
This commit is contained in:
Julien Fontanet 2016-02-19 10:32:17 +01:00
commit 548754821e

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}`,