Skip to content

Commit 97c66de

Browse files
committed
added review comments
1 parent db864ce commit 97c66de

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

src/PowerShell/ServicePrincipalLogin.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ export class ServicePrincipalLogin implements IAzurePowerShellSession {
4747
const script: string = new ScriptBuilder().getAzPSLoginScript(ServicePrincipalLogin.scheme, this.tenantId, args);
4848
await PowerShellToolRunner.init();
4949
await PowerShellToolRunner.executePowerShellScriptBlock(script, options);
50-
const outputJson: any = JSON.parse(output.trim());
51-
if (!(Constants.Success in outputJson)) {
52-
throw new Error(`Azure PowerShell login failed with error: ${outputJson[Constants.Error]}`);
50+
const result: any = JSON.parse(output.trim());
51+
if (!(Constants.Success in result)) {
52+
throw new Error(`Azure PowerShell login failed with error: ${result[Constants.Error]}`);
5353
}
5454
}
5555

src/PowerShell/Utilities/Utils.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ import ScriptBuilder from './ScriptBuilder';
55
import PowerShellToolRunner from './PowerShellToolRunner';
66

77
export default class Utils {
8+
/**
9+
* Add the folder path where Az modules are present to PSModulePath based on runner
10+
*
11+
* @param azPSVersion
12+
*
13+
* If azPSVersion is empty, folder path in which all Az modules are present are set
14+
* If azPSVersion is not empty, folder path of exact Az module version is set
15+
*
16+
*/
817
static setPSModulePath(azPSVersion: string = "") {
918
let modulePath: string = "";
1019
const runner: string = process.env.RUNNER_OS || os.type();
@@ -37,11 +46,11 @@ export default class Utils {
3746
await PowerShellToolRunner.init();
3847
await PowerShellToolRunner.executePowerShellScriptBlock(new ScriptBuilder()
3948
.getLatestModuleScript(moduleName), options);
40-
const outputJson = JSON.parse(output.trim());
41-
if (!(Constants.Success in outputJson)) {
42-
throw new Error(outputJson[Constants.Error]);
49+
const result = JSON.parse(output.trim());
50+
if (!(Constants.Success in result)) {
51+
throw new Error(result[Constants.Error]);
4352
}
44-
const azLatestVersion: string = outputJson[Constants.AzVersion];
53+
const azLatestVersion: string = result[Constants.AzVersion];
4554
if (!Utils.isValidVersion(azLatestVersion)) {
4655
throw new Error(`Invalid AzPSVersion: ${azLatestVersion}`);
4756
}

0 commit comments

Comments
 (0)