From c21c6f3a556bb7952b8a3bffe2ebb12f96d1c12b Mon Sep 17 00:00:00 2001 From: Julien Fontanet Date: Tue, 4 Jul 2017 17:40:41 +0200 Subject: [PATCH] fix(Xapi#uploadPoolPatch): fix patch upload Fixes vatesfr/xo-web#2254 --- src/xapi/mixins/patching.js | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/xapi/mixins/patching.js b/src/xapi/mixins/patching.js index 856d47fb1..5795f44ed 100644 --- a/src/xapi/mixins/patching.js +++ b/src/xapi/mixins/patching.js @@ -20,6 +20,7 @@ import { import { debug, + extractOpaqueRef, useUpdateSystem } from '../utils' @@ -211,18 +212,14 @@ export default { // ----------------------------------------------------------------- // platform_version < 2.1.1 ---------------------------------------- - async uploadPoolPatch (stream, patchName = 'unknown') { - const taskRef = await this.createTask('Patch upload', patchName) - - const task = this.watchTask(taskRef) - const [ patchRef ] = await Promise.all([ - task, - this.putResource(stream, '/pool_patch_upload', { - query: { - task_id: taskRef - } - }) - ]) + async uploadPoolPatch (stream, patchName) { + const patchRef = await this.putResource( + stream, + '/pool_patch_upload', + { + task: this.createTask('Patch upload', patchName) + } + ).then(extractOpaqueRef) return this._getOrWaitObject(patchRef) },