@@ -24,6 +24,15 @@ const Constants_1 = __importDefault(require("../Constants"));
2424const ScriptBuilder_1 = __importDefault ( require ( "./ScriptBuilder" ) ) ;
2525const PowerShellToolRunner_1 = __importDefault ( require ( "./PowerShellToolRunner" ) ) ;
2626class 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