Skip to content

Commit c909df3

Browse files
committed
added review comments
1 parent 7fc98cf commit c909df3

6 files changed

Lines changed: 16 additions & 16 deletions

File tree

lib/PowerShell/Constants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Object.defineProperty(exports, "__esModule", { value: true });
33
class Constants {
44
}
5-
exports.Constants = Constants;
5+
exports.default = Constants;
66
Constants.prefix = "az_";
77
Constants.moduleName = "Az.Accounts";
88
Constants.versionPattern = /[0-9]\.[0-9]\.[0-9]/;

lib/PowerShell/ServicePrincipalLogin.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const core = __importStar(require("@actions/core"));
2323
const Utils_1 = __importDefault(require("./Utilities/Utils"));
2424
const PowerShellToolRunner_1 = __importDefault(require("./Utilities/PowerShellToolRunner"));
2525
const ScriptBuilder_1 = __importDefault(require("./Utilities/ScriptBuilder"));
26-
const Constants_1 = require("./Constants");
26+
const Constants_1 = __importDefault(require("./Constants"));
2727
class ServicePrincipalLogin {
2828
constructor(servicePrincipalId, servicePrincipalKey, tenantId, subscriptionId) {
2929
this.servicePrincipalId = servicePrincipalId;
@@ -34,21 +34,21 @@ class ServicePrincipalLogin {
3434
initialize() {
3535
return __awaiter(this, void 0, void 0, function* () {
3636
Utils_1.default.setPSModulePath();
37-
const azLatestVersion = yield Utils_1.default.getLatestModule(Constants_1.Constants.moduleName);
37+
const azLatestVersion = yield Utils_1.default.getLatestModule(Constants_1.default.moduleName);
3838
core.debug(`Az Module version used: ${azLatestVersion}`);
39-
Utils_1.default.setPSModulePath(`${Constants_1.Constants.prefix}${azLatestVersion}`);
39+
Utils_1.default.setPSModulePath(`${Constants_1.default.prefix}${azLatestVersion}`);
4040
});
4141
}
4242
login() {
4343
return __awaiter(this, void 0, void 0, function* () {
44-
PowerShellToolRunner_1.default.init();
44+
yield PowerShellToolRunner_1.default.init();
4545
const scriptBuilder = new ScriptBuilder_1.default();
4646
const script = scriptBuilder.getScript(ServicePrincipalLogin.scheme, this.tenantId, this.servicePrincipalId, this.servicePrincipalKey, this.subscriptionId, ServicePrincipalLogin.environment, ServicePrincipalLogin.scopeLevel);
4747
PowerShellToolRunner_1.default.executePowerShellCommand(script);
4848
});
4949
}
5050
}
5151
exports.ServicePrincipalLogin = ServicePrincipalLogin;
52-
ServicePrincipalLogin.environment = Constants_1.Constants.environment;
53-
ServicePrincipalLogin.scopeLevel = Constants_1.Constants.scopeLevel;
54-
ServicePrincipalLogin.scheme = Constants_1.Constants.scheme;
52+
ServicePrincipalLogin.environment = Constants_1.default.environment;
53+
ServicePrincipalLogin.scopeLevel = Constants_1.default.scopeLevel;
54+
ServicePrincipalLogin.scheme = Constants_1.default.scheme;

lib/PowerShell/Utilities/Utils.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
2020
};
2121
Object.defineProperty(exports, "__esModule", { value: true });
2222
const os = __importStar(require("os"));
23-
const Constants_1 = require("../Constants");
23+
const Constants_1 = __importDefault(require("../Constants"));
2424
const PowerShellToolRunner_1 = __importDefault(require("./PowerShellToolRunner"));
2525
class Utils {
2626
static getLatestModule(moduleName) {
@@ -37,7 +37,7 @@ class Utils {
3737
}
3838
}
3939
};
40-
PowerShellToolRunner_1.default.init();
40+
yield PowerShellToolRunner_1.default.init();
4141
yield PowerShellToolRunner_1.default.executePowerShellCommand(`(Get-Module -Name ${moduleName} -ListAvailable | Sort-Object Version -Descending | Select-Object -First 1).Version.ToString()`, options);
4242
if (!Utils.isValidVersion(output.trim())) {
4343
return "";
@@ -46,7 +46,7 @@ class Utils {
4646
});
4747
}
4848
static isValidVersion(version) {
49-
return !!version.match(Constants_1.Constants.versionPattern);
49+
return !!version.match(Constants_1.default.versionPattern);
5050
}
5151
static setPSModulePath(azPSVersion = "") {
5252
let modulePath = "";

src/PowerShell/Constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export class Constants {
1+
export default class Constants {
22
static readonly prefix: string = "az_";
33
static readonly moduleName: string = "Az.Accounts";
44
static readonly versionPattern = /[0-9]\.[0-9]\.[0-9]/;

src/PowerShell/ServicePrincipalLogin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as core from '@actions/core';
33
import Utils from './Utilities/Utils';
44
import PowerShellToolRunner from './Utilities/PowerShellToolRunner';
55
import ScriptBuilder from './Utilities/ScriptBuilder';
6-
import { Constants } from './Constants';
6+
import Constants from './Constants';
77

88
export class ServicePrincipalLogin implements IAzurePowerShellSession {
99
static readonly environment: string = Constants.environment;
@@ -29,7 +29,7 @@ export class ServicePrincipalLogin implements IAzurePowerShellSession {
2929
}
3030

3131
async login() {
32-
PowerShellToolRunner.init();
32+
await PowerShellToolRunner.init();
3333
const scriptBuilder: ScriptBuilder = new ScriptBuilder();
3434
const script: string = scriptBuilder.getScript(ServicePrincipalLogin.scheme, this.tenantId, this.servicePrincipalId, this.servicePrincipalKey,
3535
this.subscriptionId, ServicePrincipalLogin.environment, ServicePrincipalLogin.scopeLevel);

src/PowerShell/Utilities/Utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as os from 'os';
22
import * as exec from '@actions/exec';
33
import * as io from '@actions/io';
44

5-
import { Constants } from '../Constants';
5+
import Constants from '../Constants';
66
import PowerShellToolRunner from './PowerShellToolRunner';
77

88
export default class Utils {
@@ -19,7 +19,7 @@ export default class Utils {
1919
}
2020
}
2121
};
22-
PowerShellToolRunner.init();
22+
await PowerShellToolRunner.init();
2323
await PowerShellToolRunner.executePowerShellCommand(`(Get-Module -Name ${moduleName} -ListAvailable | Sort-Object Version -Descending | Select-Object -First 1).Version.ToString()`, options);
2424
if(!Utils.isValidVersion(output.trim())) {
2525
return "";

0 commit comments

Comments
 (0)