fix(Xapi#uploadPoolPatch): fix patch upload

Fixes vatesfr/xo-web#2254
This commit is contained in:
Julien Fontanet 2017-07-04 17:40:41 +02:00
parent 1b161843ed
commit c21c6f3a55

View File

@ -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)
},