fix(xen-servers#getXenServer): should return raw server (#4791)

This commit is contained in:
badrAZ 2020-02-11 10:05:33 +01:00 committed by GitHub
parent 6139cb50bc
commit 4260099c23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -137,7 +137,7 @@ export default class {
username,
}
) {
const server = await this.getXenServer(id)
const server = await this._getXenServer(id)
const xapi = this._xapis[id]
const requireDisconnected =
allowUnauthorized !== undefined ||
@ -182,9 +182,13 @@ export default class {
await this._servers.update(server)
}
async getXenServer(id) {
return (await this._getXenServer(id)).properties
}
// TODO: this method will no longer be async when servers are
// integrated to the main collection.
async getXenServer(id) {
async _getXenServer(id) {
const server = await this._servers.first(id)
if (server === undefined) {
throw noSuchObject(id, 'xenServer')
@ -301,7 +305,7 @@ export default class {
}
async connectXenServer(id) {
const server = (await this.getXenServer(id)).properties
const server = await this.getXenServer(id)
if (this._getXenServerStatus(id) !== 'disconnected') {
throw new Error('the server is already connected')
@ -553,7 +557,7 @@ export default class {
await xapi.ejectHostFromPool(hostId)
this.getXenServer(this._serverIdsByPool[poolId])
.then(async ({ properties }) => {
.then(async properties => {
const { id } = await this.registerXenServer({
...properties,
host: address,