fix(xo-server/proxy.update): only check address/VM duplicates on change (#4723)

See xoa#49
This commit is contained in:
badrAZ
2020-02-03 09:37:54 +01:00
committed by GitHub
parent f0e87e71ab
commit e6c8d6cc7d

View File

@@ -109,10 +109,12 @@ export default class Proxy {
@synchronizedWrite
async updateProxy(id, { address, authenticationToken, name, vmUuid }) {
// TODO: don't throw if these properties aren't modified
await this._throwIfRegistered(address, vmUuid)
const proxy = await this._getProxy(id)
await this._throwIfRegistered(
proxy.address !== address ? address : undefined,
proxy.vm !== vmUuid ? vmUuid : undefined
)
patch(proxy, { address, authenticationToken, name, vmUuid })
return this._db
.update(proxy)