Merge pull request #8 from vatesfr/conditional-reporting
Implement conditional reporting.
This commit is contained in:
commit
548754821e
@ -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}`,
|
||||
|
Loading…
Reference in New Issue
Block a user