feat(xo-server/plugins): unload plugin on configuration purge (#6172)

This commit is contained in:
Pierre Donias 2022-04-07 14:49:36 +02:00 committed by GitHub
parent 4fe9a4eb59
commit 472bececb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,6 @@
import Ajv from 'ajv'
import mapToArray from 'lodash/map.js'
import noop from 'lodash/noop.js'
import { createLogger } from '@xen-orchestra/log'
import { invalidParameters, noSuchObject } from 'xo-common/api-errors.js'
@ -238,6 +239,7 @@ export default class {
}
async purgePluginConfiguration(id) {
await this.unloadPlugin(id).catch(noop)
await this._pluginsMetadata.merge(id, { configuration: undefined })
}