@@ -177,6 +177,13 @@ public ITemplateSpecsClient TemplateSpecsClient
177177 set { this . templateSpecsClient = value ; }
178178 }
179179
180+ protected override void OnBeginProcessing ( )
181+ {
182+ TemplateFile = this . TryResolvePath ( TemplateFile ) ;
183+ TemplateParameterFile = this . TryResolvePath ( TemplateParameterFile ) ;
184+ base . OnBeginProcessing ( ) ;
185+ }
186+
180187 public new virtual object GetDynamicParameters ( )
181188 {
182189 if ( BicepUtility . IsBicepFile ( TemplateUri ) )
@@ -331,7 +338,7 @@ public ITemplateSpecsClient TemplateSpecsClient
331338 protected Hashtable GetTemplateParameterObject ( Hashtable templateParameterObject )
332339 {
333340 // NOTE(jogao): create a new Hashtable so that user can re-use the templateParameterObject.
334- var prameterObject = new Hashtable ( ) ;
341+ var parameterObject = new Hashtable ( ) ;
335342 if ( templateParameterObject != null )
336343 {
337344 foreach ( var parameterKey in templateParameterObject . Keys )
@@ -340,21 +347,24 @@ protected Hashtable GetTemplateParameterObject(Hashtable templateParameterObject
340347 var hashtableParameter = templateParameterObject [ parameterKey ] as Hashtable ;
341348 if ( hashtableParameter != null && hashtableParameter . ContainsKey ( "reference" ) )
342349 {
343- prameterObject [ parameterKey ] = templateParameterObject [ parameterKey ] ;
350+ parameterObject [ parameterKey ] = templateParameterObject [ parameterKey ] ;
344351 }
345352 else
346353 {
347- prameterObject [ parameterKey ] = new Hashtable { { "value" , templateParameterObject [ parameterKey ] } } ;
354+ parameterObject [ parameterKey ] = new Hashtable { { "value" , templateParameterObject [ parameterKey ] } } ;
348355 }
349356 }
350357 }
351358
352359 // Load parameters from the file
353360 string templateParameterFilePath = this . ResolvePath ( TemplateParameterFile ) ;
354- if ( templateParameterFilePath != null && FileUtilities . DataStore . FileExists ( templateParameterFilePath ) )
361+ if ( templateParameterFilePath != null )
355362 {
356- var parametersFromFile = TemplateUtility . ParseTemplateParameterFileContents ( templateParameterFilePath ) ;
357- parametersFromFile . ForEach ( dp =>
363+ // Check whether templateParameterFilePath exists
364+ if ( FileUtilities . DataStore . FileExists ( templateParameterFilePath ) )
365+ {
366+ var parametersFromFile = TemplateUtility . ParseTemplateParameterFileContents ( templateParameterFilePath ) ;
367+ parametersFromFile . ForEach ( dp =>
358368 {
359369 var parameter = new Hashtable ( ) ;
360370 if ( dp . Value . Value != null )
@@ -366,18 +376,25 @@ protected Hashtable GetTemplateParameterObject(Hashtable templateParameterObject
366376 parameter . Add ( "reference" , dp . Value . Reference ) ;
367377 }
368378
369- prameterObject [ dp . Key ] = parameter ;
379+ parameterObject [ dp . Key ] = parameter ;
370380 } ) ;
371- }
372381
382+ }
383+ else
384+ {
385+ // To not break previous behavior, just output a warning.
386+ WriteWarning ( "${templateParameterFilePath} does not exist" ) ;
387+ }
388+ }
389+
373390 // Load dynamic parameters
374391 IEnumerable < RuntimeDefinedParameter > parameters = PowerShellUtilities . GetUsedDynamicParameters ( this . AsJobDynamicParameters , MyInvocation ) ;
375392 if ( parameters . Any ( ) )
376393 {
377- parameters . ForEach ( dp => prameterObject [ ( ( ParameterAttribute ) dp . Attributes [ 0 ] ) . HelpMessage ] = new Hashtable { { "value" , dp . Value } } ) ;
394+ parameters . ForEach ( dp => parameterObject [ ( ( ParameterAttribute ) dp . Attributes [ 0 ] ) . HelpMessage ] = new Hashtable { { "value" , dp . Value } } ) ;
378395 }
379396
380- return prameterObject ;
397+ return parameterObject ;
381398 }
382399
383400 protected string GetDeploymentDebugLogLevel ( string deploymentDebugLogLevel )
0 commit comments