Skip to content

Commit 6df92eb

Browse files
committed
added review comments
1 parent 97c66de commit 6df92eb

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

lib/PowerShell/ServicePrincipalLogin.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ class ServicePrincipalLogin {
5959
const script = new ScriptBuilder_1.default().getAzPSLoginScript(ServicePrincipalLogin.scheme, this.tenantId, args);
6060
yield PowerShellToolRunner_1.default.init();
6161
yield PowerShellToolRunner_1.default.executePowerShellScriptBlock(script, options);
62-
const outputJson = JSON.parse(output.trim());
63-
if (!(Constants_1.default.Success in outputJson)) {
64-
throw new Error(`Azure PowerShell login failed with error: ${outputJson[Constants_1.default.Error]}`);
62+
const result = JSON.parse(output.trim());
63+
if (!(Constants_1.default.Success in result)) {
64+
throw new Error(`Azure PowerShell login failed with error: ${result[Constants_1.default.Error]}`);
6565
}
6666
});
6767
}

lib/PowerShell/Utilities/Utils.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ const Constants_1 = __importDefault(require("../Constants"));
2424
const ScriptBuilder_1 = __importDefault(require("./ScriptBuilder"));
2525
const PowerShellToolRunner_1 = __importDefault(require("./PowerShellToolRunner"));
2626
class Utils {
27+
/**
28+
* Add the folder path where Az modules are present to PSModulePath based on runner
29+
*
30+
* @param azPSVersion
31+
*
32+
* If azPSVersion is empty, folder path in which all Az modules are present are set
33+
* If azPSVersion is not empty, folder path of exact Az module version is set
34+
*
35+
*/
2736
static setPSModulePath(azPSVersion = "") {
2837
let modulePath = "";
2938
const runner = process.env.RUNNER_OS || os.type();
@@ -56,11 +65,11 @@ class Utils {
5665
yield PowerShellToolRunner_1.default.init();
5766
yield PowerShellToolRunner_1.default.executePowerShellScriptBlock(new ScriptBuilder_1.default()
5867
.getLatestModuleScript(moduleName), options);
59-
const outputJson = JSON.parse(output.trim());
60-
if (!(Constants_1.default.Success in outputJson)) {
61-
throw new Error(outputJson[Constants_1.default.Error]);
68+
const result = JSON.parse(output.trim());
69+
if (!(Constants_1.default.Success in result)) {
70+
throw new Error(result[Constants_1.default.Error]);
6271
}
63-
const azLatestVersion = outputJson[Constants_1.default.AzVersion];
72+
const azLatestVersion = result[Constants_1.default.AzVersion];
6473
if (!Utils.isValidVersion(azLatestVersion)) {
6574
throw new Error(`Invalid AzPSVersion: ${azLatestVersion}`);
6675
}

0 commit comments

Comments
 (0)