Implement conditional reporting.
This commit is contained in:
parent
05c325d686
commit
77f85579e3
@ -60,6 +60,7 @@ class BackupReportsXoPlugin {
|
|||||||
async _listener (status) {
|
async _listener (status) {
|
||||||
let nSuccess = 0
|
let nSuccess = 0
|
||||||
let nCalls = 0
|
let nCalls = 0
|
||||||
|
let reportWhen
|
||||||
|
|
||||||
const text = []
|
const text = []
|
||||||
|
|
||||||
@ -73,6 +74,12 @@ class BackupReportsXoPlugin {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reportWhen = call.params._reportWhen
|
||||||
|
|
||||||
|
if (reportWhen === 'never') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
let vmStatus
|
let vmStatus
|
||||||
|
|
||||||
if (call.error) {
|
if (call.error) {
|
||||||
@ -114,6 +121,10 @@ class BackupReportsXoPlugin {
|
|||||||
const end = moment(status.end)
|
const end = moment(status.end)
|
||||||
const duration = moment.duration(end - start).humanize()
|
const duration = moment.duration(end - start).humanize()
|
||||||
|
|
||||||
|
if (reportWhen === 'fail' && globalStatus === 'Success') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Global status.
|
// Global status.
|
||||||
text.unshift([
|
text.unshift([
|
||||||
`## Global status: ${globalStatus}`,
|
`## Global status: ${globalStatus}`,
|
||||||
|
Loading…
Reference in New Issue
Block a user