fix(xo-server-backup-reports): dont bail on successful VM with reportWhen failure (#3185)

Fixes #3181
This commit is contained in:
badrAZ
2018-07-16 11:30:25 +02:00
committed by Julien Fontanet
parent 70b17a6fa9
commit c9f08a2f8f
2 changed files with 5 additions and 3 deletions

View File

@@ -6,8 +6,11 @@
### Bug fixes
- [Backup Reports] Report not sent if reportWhen failure and at least a VM is successfull [#3181](https://github.com/vatesfr/xen-orchestra/issues/3181) (PR [#3185](https://github.com/vatesfr/xen-orchestra/pull/3185))
### Released packages
- xo-server-backup-reports v0.12.3
- xo-server v5.23.0
- xo-web v5.23.0

View File

@@ -187,10 +187,9 @@ class BackupReportsXoPlugin {
let nFailures = 0
let nSkipped = 0
let nInterrupted = 0
let nSuccesses = 0
for (const taskLog of log.tasks) {
if (taskLog.status === 'success' && reportWhen === 'failure') {
return
continue
}
const vmId = taskLog.data.id
@@ -361,13 +360,13 @@ class BackupReportsXoPlugin {
`[(Interrupted) ${vm !== undefined ? vm.name_label : 'undefined'}]`
)
} else {
++nSuccesses
successfulVmsText.push(...text, '', '', ...subText, '')
}
}
}
const nVms = log.tasks.length
const nSuccesses = nVms - nFailures - nSkipped - nInterrupted
let markdown = [
`## Global status: ${log.status}`,
'',