fix(xo-server/config): configure plugins on config import (#6171)

See https://xcp-ng.org/forum/topic/5720/ztp-restore-xoa-from-backup
This commit is contained in:
Pierre Donias 2022-04-04 15:44:05 +02:00 committed by GitHub
parent 3ab2dad19b
commit ee47a361b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -11,6 +11,8 @@
> Users must be able to say: “I had this issue, happy to know it's fixed”
- [Plugins] Automatically configure plugins when a configuration file is imported (PR [#6171](https://github.com/vatesfr/xen-orchestra/pull/6171))
### Packages to release
> Packages will be released in the order they are here, therefore, they should
@ -30,3 +32,4 @@
- xen-api minor
- @xen-orchestra/proxy patch
- xo-server patch

View File

@ -27,7 +27,15 @@ export default class {
app.addConfigManager(
'plugins',
() => this._pluginsMetadata.get(),
plugins => Promise.all(plugins.map(plugin => this._pluginsMetadata.save(plugin)))
plugins =>
Promise.all(
plugins.map(async plugin => {
await this._pluginsMetadata.save(plugin)
if (plugin.configuration !== undefined && this._plugins[plugin.id] !== undefined) {
await this.configurePlugin(plugin.id, plugin.configuration)
}
})
)
)
})
}