fix(xo-server-usage-report): use @xen-orchestra/log to log errors (#7096)

Fixes Zammad#14579
Fixes Zammad#18183

Better handles error objects with a circular structure and avoids "Converting
circular structure to JSON" error on stringify
This commit is contained in:
Pierre Donias 2023-10-16 10:07:57 +02:00 committed by GitHub
parent fb52868074
commit 04dfd9a02c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -17,6 +17,7 @@
- [Rolling Pool Update] After the update, when migrating VMs back to their host, do not migrate VMs that are already on the right host [Forum#7802](https://xcp-ng.org/forum/topic/7802) (PR [#7071](https://github.com/vatesfr/xen-orchestra/pull/7071))
- [RPU] Fix "XenServer credentials not found" when running a Rolling Pool Update on a XenServer pool (PR [#7089](https://github.com/vatesfr/xen-orchestra/pull/7089))
- [Usage report] Fix "Converting circular structure to JSON" error
### Packages to release
@ -38,6 +39,7 @@
- @xen-orchestra/xapi minor
- xo-server minor
- xo-server-backup-reports minor
- xo-server-usage-report patch
- xo-web minor
<!--packages-end-->

View File

@ -477,7 +477,7 @@ async function getHostsMissingPatches({ runningHosts, xo }) {
.getXapi(host)
.listMissingPatches(host._xapiId)
.catch(error => {
console.error('[WARN] error on fetching hosts missing patches:', JSON.stringify(error))
log.warn('Error on fetching hosts missing patches', { error })
return []
})
@ -741,7 +741,7 @@ class UsageReportPlugin {
try {
await this._sendReport(true)
} catch (error) {
console.error('[WARN] scheduled function:', (error && error.stack) || error)
log.warn('Scheduled usage report error', { error })
}
})