Correctly handle patch upload error.

This commit is contained in:
Julien Fontanet 2015-05-05 18:55:46 +02:00
parent 8592ead0e3
commit 53e94378ae

View File

@ -183,7 +183,9 @@ export default class Xapi extends XapiBase {
async _installHostPatch (host, stream, length) {
const taskRef = await this._createTask('Patch upload from XO')
got.put('http://' + host.address + '/pool_patch_upload', {
await Promise.all([
gotPromise('http://' + host.address + '/pool_patch_upload', {
method: 'put',
body: stream,
query: {
session_id: this.sessionId,
@ -192,9 +194,8 @@ export default class Xapi extends XapiBase {
headers: {
'content-length': length
}
})
await this._watchTask(taskRef).then(
}),
this._watchTask(taskRef).then(
(patchRef) => {
debug('patch upload succeeded')
@ -206,6 +207,7 @@ export default class Xapi extends XapiBase {
throw error
}
)
])
}
async installHostPatchFromUrl (host, patchUrl) {