fix(xo-server/remotes): always JSON encode benchmarks (#4197)

See xoa-support#1464

Fix an issue when restoring from config.
This commit is contained in:
Julien Fontanet
2019-05-09 13:58:36 +02:00
committed by GitHub
parent 13237180a2
commit 4e88125cbe
3 changed files with 14 additions and 8 deletions

View File

@@ -6,6 +6,7 @@
- [Pool/Patches] Fix "an error has occurred" in "Applied patches" [#4192](https://github.com/vatesfr/xen-orchestra/issues/4192) (PR [#4193](https://github.com/vatesfr/xen-orchestra/pull/4193))
- [Backup NG] Fix report sent even though "Never" is selected [#4092](https://github.com/vatesfr/xen-orchestra/issues/4092) (PR [#4178](https://github.com/vatesfr/xen-orchestra/pull/4178))
- [Remotes] Fix issues after a config import (PR [#4197](https://github.com/vatesfr/xen-orchestra/pull/4197))
### Released packages

View File

@@ -22,4 +22,16 @@ export class Remotes extends Collection {
})
return remotes
}
_update(remotes) {
return super._update(
remotes.map(remote => {
const { benchmarks } = remote
if (benchmarks !== undefined) {
remote.benchmarks = JSON.stringify(benchmarks)
}
return remote
})
)
}
}

View File

@@ -168,7 +168,7 @@ export default class {
}
@synchronized()
async _updateRemote(id, { benchmarks, url, ...props }) {
async _updateRemote(id, { url, ...props }) {
const remote = await this._getRemote(id)
// url is handled separately to take care of obfuscated values
@@ -176,13 +176,6 @@ export default class {
remote.url = format(sensitiveValues.merge(parse(url), parse(remote.url)))
}
if (
benchmarks !== undefined ||
(benchmarks = remote.benchmarks) !== undefined
) {
remote.benchmarks = JSON.stringify(benchmarks)
}
patch(remote, props)
return (await this._remotes.update(remote)).properties