Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Apr 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -30,3 +32,4 @@

- xen-api minor
- @xen-orchestra/proxy patch
- xo-server patch
10 changes: 9 additions & 1 deletion packages/xo-server/src/xo-mixins/plugins.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
})
)
)
})
}
Expand Down