feat(xo-server-backup-reports): errors are logged as XO tasks
This commit is contained in:
parent
2e689592f1
commit
2af74008b2
@ -8,6 +8,7 @@
|
||||
> Users must be able to say: “Nice enhancement, I'm eager to test it”
|
||||
|
||||
- [Host/Advanced] Allow to force _Smart reboot_ if some resident VMs have the suspend operation blocked [Forum#7136](https://xcp-ng.org/forum/topic/7136/suspending-vms-during-host-reboot/23) (PR [#7025](https://github.com/vatesfr/xen-orchestra/pull/7025))
|
||||
- [Plugin/backup-report] Errors are now listed in XO tasks
|
||||
|
||||
### Bug fixes
|
||||
|
||||
|
@ -90,6 +90,8 @@ const formatSpeed = (bytes, milliseconds) =>
|
||||
})
|
||||
: 'N/A'
|
||||
|
||||
const noop = Function.prototype
|
||||
|
||||
const NO_VMS_MATCH_THIS_PATTERN = 'no VMs match this pattern'
|
||||
const NO_SUCH_OBJECT_ERROR = 'no such object'
|
||||
const UNHEALTHY_VDI_CHAIN_ERROR = 'unhealthy VDI chain'
|
||||
@ -193,13 +195,17 @@ const toMarkdown = parts => {
|
||||
class BackupReportsXoPlugin {
|
||||
constructor(xo) {
|
||||
this._xo = xo
|
||||
this._eventListener = async (...args) => {
|
||||
try {
|
||||
await this._report(...args)
|
||||
} catch (error) {
|
||||
logger.warn(error)
|
||||
}
|
||||
}
|
||||
|
||||
const report = this._report
|
||||
this._report = (...args) =>
|
||||
xo.tasks
|
||||
.create(
|
||||
{ type: 'xo:xo-server-backup-reports:sendReport', name: 'Sending backup report', runId: args[0] },
|
||||
{ clearLogOnSuccess: true }
|
||||
)
|
||||
.run(() => report.call(this, ...args))
|
||||
|
||||
this._eventListener = (...args) => this._report(...args).catch(noop)
|
||||
}
|
||||
|
||||
configure({ toMails, toXmpp }) {
|
||||
|
Loading…
Reference in New Issue
Block a user