fix(xo-server/setData): dont wait for update if no changes (#5027)
If an other_config entry is set to the same value as it was before, the object will not be updated and the _waitObject promise will "never" resolve.
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
- Don't log server's credentials in case of `SESSION_AUTHENTICATION_FAILED` error (PR [#4995](https://github.com/vatesfr/xen-orchestra/pull/4995))
|
||||
- [Plugin/perf-alert] Fix compatibility of the alert messages with XenCenter (PR [#5004](https://github.com/vatesfr/xen-orchestra/pull/5004))
|
||||
- [Plugin/backup-reports] Fix `No recipients defined` error when recipients defined at plugin level (PR [#4998](https://github.com/vatesfr/xen-orchestra/pull/4998))
|
||||
- [Snapshots] Fix reverts sometimes being stuck (PR [#5027](https://github.com/vatesfr/xen-orchestra/pull/5027))
|
||||
|
||||
### Released packages
|
||||
|
||||
|
||||
@@ -423,12 +423,17 @@ export default class {
|
||||
return value && JSON.parse(value)
|
||||
},
|
||||
setData: async (id, key, value) => {
|
||||
await xapi
|
||||
.getObject(id)
|
||||
.update_other_config(
|
||||
`xo:${camelToSnakeCase(key)}`,
|
||||
value !== null ? JSON.stringify(value) : value
|
||||
)
|
||||
key = `xo:${camelToSnakeCase(key)}`
|
||||
value = value !== null ? JSON.stringify(value) : value
|
||||
|
||||
const object = await xapi.getObject(id)
|
||||
if (
|
||||
object.other_config[key] === (value === null ? undefined : value)
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
await object.update_other_config(key, value)
|
||||
|
||||
// Register the updated object.
|
||||
addObject(await xapi._waitObject(id))
|
||||
|
||||
Reference in New Issue
Block a user