Skip to content

Commit

Permalink
fix(xo-server-backup-reports): dont bail on successful VM with report…
Browse files Browse the repository at this point in the history
…When failure (#3185)

Fixes #3181
  • Loading branch information
badrAZ authored and julien-f committed Jul 16, 2018
1 parent 70b17a6 commit c9f08a2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -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

Expand Down
5 changes: 2 additions & 3 deletions packages/xo-server-backup-reports/src/index.js
Expand Up @@ -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
Expand Down Expand Up @@ -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}`,
'',
Expand Down

0 comments on commit c9f08a2

Please sign in to comment.