feat(xo-server/proxies): unbind license on forgetting a proxy

See xoa#52
This commit is contained in:
badrAZ 2020-04-14 15:29:18 +02:00 committed by Julien Fontanet
parent aba8b764b6
commit ac524dd799

View File

@ -83,8 +83,20 @@ export default class Proxy {
return id return id
} }
unregisterProxy(id) { async unregisterProxy(id) {
return this._db.remove(id) const { vmUuid } = await this._getProxy(id)
await this._db.remove(id)
if (vmUuid !== undefined) {
// waiting the unbind of the license in order to be available at the end of the method call
await this._app
.unbindLicense({
boundObjectId: vmUuid,
productId: this._xoProxyConf.licenseProductId,
})
.catch(log.warn)
}
} }
async destroyProxy(id) { async destroyProxy(id) {