Upgrade must and got.

This commit is contained in:
Julien Fontanet 2015-10-05 17:23:38 +02:00
parent 1604d327da
commit 45da6fb39f
2 changed files with 8 additions and 13 deletions

View File

@ -47,7 +47,7 @@
"express-session": "^1.11.3",
"fs-extra": "^0.24.0",
"fs-promise": "^0.3.1",
"got": "^3.2.0",
"got": "^4.2.0",
"graceful-fs": "^4.1.2",
"hashy": "~0.4.2",
"http-server-plus": "^0.5.1",
@ -108,7 +108,7 @@
"gulp-watch": "^4.2.2",
"leche": "^2.1.1",
"mocha": "^2.2.1",
"must": "^0.12.0",
"must": "^0.13.1",
"node-inspector": "^0.12.2",
"sinon": "^1.14.1",
"standard": "^5.2.1"

View File

@ -20,8 +20,7 @@ import {
camelToSnakeCase,
ensureArray,
noop, parseXml,
pFinally,
promisify
pFinally
} from './utils'
import {JsonRpcError} from './api-errors'
@ -29,10 +28,6 @@ const debug = createDebug('xo:xapi')
// ===================================================================
const gotPromise = promisify(got)
// ===================================================================
const typeToNamespace = Object.create(null)
forEach([
'Bond',
@ -264,7 +259,7 @@ export default class Xapi extends XapiBase {
// FIXME: should be static
@debounce(24 * 60 * 60 * 1000)
async _getXenUpdates () {
const [body, {statusCode}] = await gotPromise(
const {body, statusCode} = await got(
'http://updates.xensource.com/XenServer/updates.xml'
)
@ -377,7 +372,7 @@ export default class Xapi extends XapiBase {
const taskRef = await this._createTask('Patch upload')
const [, patchRef] = await Promise.all([
gotPromise('http://' + this.pool.$master.address + '/pool_patch_upload', {
got('http://' + this.pool.$master.address + '/pool_patch_upload', {
method: 'put',
body: stream,
query: {
@ -408,7 +403,7 @@ export default class Xapi extends XapiBase {
const PATCH_RE = /\.xsupdate$/
const proxy = new PassThrough()
got(patchInfo.url).on('error', error => {
got.stream(patchInfo.url).on('error', error => {
// TODO: better error handling
console.error(error)
}).pipe(unzip.Parse()).on('entry', entry => {
@ -653,9 +648,9 @@ export default class Xapi extends XapiBase {
})
}
const stream = got({
const stream = got.stream({
hostname: host.address,
pathname: onlyMetadata ? '/export_metadata/' : '/export/'
path: onlyMetadata ? '/export_metadata/' : '/export/'
}, {
query: {
ref: snapshotRef || vm.$ref,