diff --git a/extensions/integration-tests/package.json b/extensions/integration-tests/package.json index e386f908fa..37e4a47baf 100644 --- a/extensions/integration-tests/package.json +++ b/extensions/integration-tests/package.json @@ -28,13 +28,11 @@ "devDependencies": { "@types/chai": "3.4.34", "@types/node": "^10.14.8", + "azure-keyvault": "^3.0.4", "chai": "3.5.0", "mocha-junit-reporter": "^1.17.0", "mocha-multi-reporters": "^1.1.7", + "ms-rest-azure": "^2.6.0", "vscode": "1.1.5" - }, - "dependencies": { - "azure-keyvault": "^3.0.4", - "ms-rest-azure": "^2.6.0" } } diff --git a/extensions/mssql/package.json b/extensions/mssql/package.json index fe7cec0c0b..3d8f0a5d3a 100644 --- a/extensions/mssql/package.json +++ b/extensions/mssql/package.json @@ -1099,7 +1099,7 @@ "figures": "^2.0.0", "find-remove": "1.2.1", "request": "^2.88.0", - "request-promise": "^4.2.2", + "request-light": "^0.3.0", "service-downloader": "0.2.1", "stream-meter": "^1.0.4", "through2": "^3.0.1", @@ -1113,7 +1113,6 @@ "@types/chai": "^4.2.11", "@types/mocha": "^7.0.2", "@types/request": "^2.48.2", - "@types/request-promise": "^4.1.44", "@types/stream-meter": "^0.0.22", "@types/through2": "^2.0.34", "chai": "^4.2.0", diff --git a/extensions/mssql/src/sparkFeature/dialog/sparkJobSubmission/sparkJobSubmissionModel.ts b/extensions/mssql/src/sparkFeature/dialog/sparkJobSubmission/sparkJobSubmissionModel.ts index fbaa68a410..4c3494ec3d 100644 --- a/extensions/mssql/src/sparkFeature/dialog/sparkJobSubmission/sparkJobSubmissionModel.ts +++ b/extensions/mssql/src/sparkFeature/dialog/sparkJobSubmission/sparkJobSubmissionModel.ts @@ -37,15 +37,14 @@ export class SparkJobSubmissionModel { constructor( private readonly _sqlClusterConnection: SqlClusterConnection, private readonly _dialog: azdata.window.Dialog, - private readonly _appContext: AppContext, - requestService?: typeof import('request-promise')) { + private readonly _appContext: AppContext) { if (!this._sqlClusterConnection || !this._dialog || !this._appContext) { throw new Error(localize('sparkJobSubmission.SparkJobSubmissionModelInitializeError', "Parameters for SparkJobSubmissionModel is illegal")); } - this._dialogService = new SparkJobSubmissionService(requestService); + this._dialogService = new SparkJobSubmissionService(); this._guidForClusterFolder = utils.generateGuid(); } diff --git a/extensions/mssql/src/sparkFeature/dialog/sparkJobSubmission/sparkJobSubmissionService.ts b/extensions/mssql/src/sparkFeature/dialog/sparkJobSubmission/sparkJobSubmissionService.ts index aafea5d0de..de4f4a999e 100644 --- a/extensions/mssql/src/sparkFeature/dialog/sparkJobSubmission/sparkJobSubmissionService.ts +++ b/extensions/mssql/src/sparkFeature/dialog/sparkJobSubmission/sparkJobSubmissionService.ts @@ -10,21 +10,9 @@ import * as constants from '../../../constants'; import { SqlClusterConnection } from '../../../objectExplorerNodeProvider/connection'; import * as utils from '../../../utils'; import * as auth from '../../../util/auth'; -import { Options } from 'request-promise'; +import * as request from 'request-light'; export class SparkJobSubmissionService { - private _requestPromise: typeof import('request-promise'); - - constructor( - requestService?: typeof import('request-promise')) { - if (requestService) { - // this is to fake the request service for test. - this._requestPromise = requestService; - } else { - this._requestPromise = require('request-promise'); - } - } - public async submitBatchJob(submissionArgs: SparkJobSubmissionInput): Promise { try { let livyUrl: string = `https://${submissionArgs.host}:${submissionArgs.port}${submissionArgs.livyPath}/`; @@ -32,12 +20,11 @@ export class SparkJobSubmissionService { // Get correct authentication headers let headers = await this.getAuthenticationHeaders(submissionArgs); - let options: Options = { - uri: livyUrl, - method: 'POST', - json: true, - rejectUnauthorized: !auth.getIgnoreSslVerificationConfigSetting(), - body: { + let options: request.XHROptions = { + url: livyUrl, + type: 'POST', + strictSSL: !auth.getIgnoreSslVerificationConfigSetting(), + data: { file: submissionArgs.sparkFile, proxyUser: submissionArgs.user, className: submissionArgs.mainClass, @@ -51,7 +38,7 @@ export class SparkJobSubmissionService { if (submissionArgs.jobArguments && submissionArgs.jobArguments.trim()) { let argsList = submissionArgs.jobArguments.split(' '); if (argsList.length > 0) { - options.body['args'] = argsList; + options.data['args'] = argsList; } } @@ -59,7 +46,7 @@ export class SparkJobSubmissionService { if (submissionArgs.jarFileList && submissionArgs.jarFileList.trim()) { let jarList = submissionArgs.jarFileList.split(';'); if (jarList.length > 0) { - options.body['jars'] = jarList; + options.data['jars'] = jarList; } } @@ -67,7 +54,7 @@ export class SparkJobSubmissionService { if (submissionArgs.pyFileList && submissionArgs.pyFileList.trim()) { let pyList = submissionArgs.pyFileList.split(';'); if (pyList.length > 0) { - options.body['pyFiles'] = pyList; + options.data['pyFiles'] = pyList; } } @@ -75,11 +62,17 @@ export class SparkJobSubmissionService { if (submissionArgs.otherFileList && submissionArgs.otherFileList.trim()) { let otherList = submissionArgs.otherFileList.split(';'); if (otherList.length > 0) { - options.body['files'] = otherList; + options.data['files'] = otherList; } } - const response = await this._requestPromise(options); + options.data = JSON.stringify(options.data); + + // Note this is currently required to be called each time since request-light is overwriting + // the setting passed in through the options. If/when that gets fixed this can be removed + request.configure(null, !auth.getIgnoreSslVerificationConfigSetting()); + + const response = JSON.parse((await request.xhr(options)).responseText); if (response && utils.isValidNumber(response.id)) { return response.id; } @@ -108,16 +101,19 @@ export class SparkJobSubmissionService { let livyUrl = `https://${submissionArgs.host}:${submissionArgs.port}${submissionArgs.livyPath}/${livyBatchId}/log`; let headers = await this.getAuthenticationHeaders(submissionArgs); - let options = { - uri: livyUrl, - method: 'GET', - json: true, - rejectUnauthorized: !auth.getIgnoreSslVerificationConfigSetting(), + let options: request.XHROptions = { + url: livyUrl, + type: 'GET', + strictSSL: !auth.getIgnoreSslVerificationConfigSetting(), // authentication headers headers: headers }; - const response = await this._requestPromise(options); + // Note this is currently required to be called each time since request-light is overwriting + // the setting passed in through the options. If/when that gets fixed this can be removed + request.configure(null, !auth.getIgnoreSslVerificationConfigSetting()); + + const response = JSON.parse((await request.xhr(options)).responseText); if (response && response.log) { return this.extractYarnAppIdFromLog(response.log); } diff --git a/extensions/mssql/yarn.lock b/extensions/mssql/yarn.lock index 1702d7e342..fa8a1473fa 100644 --- a/extensions/mssql/yarn.lock +++ b/extensions/mssql/yarn.lock @@ -2,11 +2,6 @@ # yarn lockfile v1 -"@types/bluebird@*": - version "3.5.30" - resolved "https://registry.yarnpkg.com/@types/bluebird/-/bluebird-3.5.30.tgz#ee034a0eeea8b84ed868b1aa60d690b08a6cfbc5" - integrity sha512-8LhzvcjIoqoi1TghEkRMkbbmM+jhHnBokPGkJWjclMK+Ks0MxEBow3/p2/iFTZ+OIbJHQDSfpgdZEb+af3gfVw== - "@types/bytes@^3.0.0": version "3.1.0" resolved "https://registry.yarnpkg.com/@types/bytes/-/bytes-3.1.0.tgz#835a3e4aea3b4d7604aca216a78de372bff3ecc3" @@ -32,15 +27,7 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-13.11.1.tgz#49a2a83df9d26daacead30d0ccc8762b128d53c7" integrity sha512-eWQGP3qtxwL8FGneRrC5DwrJLGN4/dH1clNTuLfN81HCrxVtxRjygDTUoZJ5ASlDEeo0ppYFQjQIlXhtXpOn6g== -"@types/request-promise@^4.1.44": - version "4.1.46" - resolved "https://registry.yarnpkg.com/@types/request-promise/-/request-promise-4.1.46.tgz#37df6efae984316dfbfbbe8fcda37f3ba52822f2" - integrity sha512-3Thpj2Va5m0ji3spaCk8YKrjkZyZc6RqUVOphA0n/Xet66AW/AiOAs5vfXhQIL5NmkaO7Jnun7Nl9NEjJ2zBaw== - dependencies: - "@types/bluebird" "*" - "@types/request" "*" - -"@types/request@*", "@types/request@^2.48.2": +"@types/request@^2.48.2": version "2.48.4" resolved "https://registry.yarnpkg.com/@types/request/-/request-2.48.4.tgz#df3d43d7b9ed3550feaa1286c6eabf0738e6cf7e" integrity sha512-W1t1MTKYR8PxICH+A4HgEIPuAC3sbljoEVfyZbeFJJDbr30guDspJri2XOaM2E+Un7ZjrihaDi7cf6fPa2tbgw== @@ -257,11 +244,6 @@ binary-extensions@^2.0.0: resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.0.0.tgz#23c0df14f6a88077f5f986c0d167ec03c3d5537c" integrity sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow== -bluebird@^3.5.0: - version "3.7.2" - resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" - integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== - brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -893,7 +875,7 @@ http-signature@~1.2.0: jsprim "^1.2.2" sshpk "^1.7.0" -https-proxy-agent@^2.2.3: +https-proxy-agent@^2.2.3, https-proxy-agent@^2.2.4: version "2.2.4" resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz#4ee7a737abd92678a293d9b34a1af4d0d08c787b" integrity sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg== @@ -1493,22 +1475,14 @@ remap-istanbul@^0.11.1: source-map "^0.6.1" through2 "2.0.1" -request-promise-core@1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.3.tgz#e9a3c081b51380dfea677336061fea879a829ee9" - integrity sha512-QIs2+ArIGQVp5ZYbWD5ZLCY29D5CfWizP8eWnm8FoGD1TX61veauETVQbrV60662V0oFBkrDOuaBI8XgtuyYAQ== +request-light@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/request-light/-/request-light-0.3.0.tgz#04daa783e7f0a70392328dda4b546f3e27845f2d" + integrity sha512-xlVlZVT0ZvCT+c3zm3SjeFCzchoQxsUUmx5fkal0I6RIDJK+lmb1UYyKJ7WM4dTfnzHP4ElWwAf8Dli8c0/tVA== dependencies: - lodash "^4.17.15" - -request-promise@^4.2.2: - version "4.2.5" - resolved "https://registry.yarnpkg.com/request-promise/-/request-promise-4.2.5.tgz#186222c59ae512f3497dfe4d75a9c8461bd0053c" - integrity sha512-ZgnepCykFdmpq86fKGwqntyTiUrHycALuGggpyCZwMvGaZWgxW6yagT0FHkgo5LzYvOaCNvxYwWYIjevSH1EDg== - dependencies: - bluebird "^3.5.0" - request-promise-core "1.1.3" - stealthy-require "^1.1.1" - tough-cookie "^2.3.3" + http-proxy-agent "^2.1.0" + https-proxy-agent "^2.2.4" + vscode-nls "^4.1.1" request@^2.88.0: version "2.88.2" @@ -1642,11 +1616,6 @@ sshpk@^1.7.0: safer-buffer "^2.0.2" tweetnacl "~0.14.0" -stealthy-require@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b" - integrity sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks= - stream-meter@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/stream-meter/-/stream-meter-1.0.4.tgz#52af95aa5ea760a2491716704dbff90f73afdd1d" @@ -1812,14 +1781,6 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" -tough-cookie@^2.3.3, tough-cookie@~2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" - integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== - dependencies: - psl "^1.1.28" - punycode "^2.1.1" - tough-cookie@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-3.0.1.tgz#9df4f57e739c26930a018184887f4adb7dca73b2" @@ -1829,6 +1790,14 @@ tough-cookie@^3.0.1: psl "^1.1.28" punycode "^2.1.1" +tough-cookie@~2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" + integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== + dependencies: + psl "^1.1.28" + punycode "^2.1.1" + tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" @@ -1928,7 +1897,7 @@ vscode-languageserver-types@3.14.0: resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.14.0.tgz#d3b5952246d30e5241592b6dde8280e03942e743" integrity sha512-lTmS6AlAlMHOvPQemVwo3CezxBp0sNB95KNPkqp3Nxd5VFEnuG1ByM0zlRWos0zjO3ZWtkvhal0COgiV1xIA4A== -vscode-nls@^4.0.0: +vscode-nls@^4.0.0, vscode-nls@^4.1.1: version "4.1.2" resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.1.2.tgz#ca8bf8bb82a0987b32801f9fddfdd2fb9fd3c167" integrity sha512-7bOHxPsfyuCqmP+hZXscLhiHwe7CSuFE4hyhbs22xPIhQ4jv99FcR4eBzfYYVLP356HNFpdvz63FFb/xw6T4Iw==