(moduleName, version)
| 8511 | }); |
| 8512 | } |
| 8513 | static checkModuleVersion(moduleName, version) { |
| 8514 | return __awaiter(this, void 0, void 0, function* () { |
| 8515 | let output = ""; |
| 8516 | const options = { |
| 8517 | listeners: { |
| 8518 | stdout: (data) => { |
| 8519 | output += data.toString(); |
| 8520 | } |
| 8521 | } |
| 8522 | }; |
| 8523 | if (!Utils.isValidVersion(output.trim())) { |
| 8524 | return ""; |
| 8525 | } |
| 8526 | yield PowerShellToolRunner_1.default.executePowerShellCommand(new ScriptBuilder_1.default() |
| 8527 | .checkModuleVersionScript(moduleName, version), options); |
| 8528 | const outputJson = JSON.parse(output.trim()); |
| 8529 | if (!(Constants_1.default.Success in outputJson)) { |
| 8530 | throw new Error(outputJson[Constants_1.default.Error]); |
| 8531 | } |
| 8532 | const versionExists = outputJson[Constants_1.default.versionExists].toLowerCase() === "true"; |
| 8533 | if (!(versionExists)) { |
| 8534 | throw new Error("Invalid azPSVersion. Refer https://aka.ms/azure-powershell-release-notes for supported versions."); |
| 8535 | } |
| 8536 | }); |
| 8537 | } |
| 8538 | static isValidVersion(version) { |
| 8539 | return !!version.match(Constants_1.default.versionPattern); |
| 8540 | } |
no test coverage detected