MCPcopy Create free account
hub / github.com/Azure/powershell / checkModuleVersion

Method checkModuleVersion

lib/index.js:8513–8537  ·  view source on GitHub ↗
(moduleName, version)

Source from the content-addressed store, hash-verified

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 }

Callers 2

importAzModuleMethod · 0.45
Utils.test.tsFile · 0.45

Calls 4

toStringMethod · 0.80
isValidVersionMethod · 0.45

Tested by

no test coverage detected