@@ -177,6 +177,13 @@ public ITemplateSpecsClient TemplateSpecsClient
177
177
set { this . templateSpecsClient = value ; }
178
178
}
179
179
180
+ protected override void OnBeginProcessing ( )
181
+ {
182
+ TemplateFile = this . TryResolvePath ( TemplateFile ) ;
183
+ TemplateParameterFile = this . TryResolvePath ( TemplateParameterFile ) ;
184
+ base . OnBeginProcessing ( ) ;
185
+ }
186
+
180
187
public new virtual object GetDynamicParameters ( )
181
188
{
182
189
if ( BicepUtility . IsBicepFile ( TemplateUri ) )
@@ -331,7 +338,7 @@ public ITemplateSpecsClient TemplateSpecsClient
331
338
protected Hashtable GetTemplateParameterObject ( Hashtable templateParameterObject )
332
339
{
333
340
// NOTE(jogao): create a new Hashtable so that user can re-use the templateParameterObject.
334
- var prameterObject = new Hashtable ( ) ;
341
+ var parameterObject = new Hashtable ( ) ;
335
342
if ( templateParameterObject != null )
336
343
{
337
344
foreach ( var parameterKey in templateParameterObject . Keys )
@@ -340,21 +347,24 @@ protected Hashtable GetTemplateParameterObject(Hashtable templateParameterObject
340
347
var hashtableParameter = templateParameterObject [ parameterKey ] as Hashtable ;
341
348
if ( hashtableParameter != null && hashtableParameter . ContainsKey ( "reference" ) )
342
349
{
343
- prameterObject [ parameterKey ] = templateParameterObject [ parameterKey ] ;
350
+ parameterObject [ parameterKey ] = templateParameterObject [ parameterKey ] ;
344
351
}
345
352
else
346
353
{
347
- prameterObject [ parameterKey ] = new Hashtable { { "value" , templateParameterObject [ parameterKey ] } } ;
354
+ parameterObject [ parameterKey ] = new Hashtable { { "value" , templateParameterObject [ parameterKey ] } } ;
348
355
}
349
356
}
350
357
}
351
358
352
359
// Load parameters from the file
353
360
string templateParameterFilePath = this . ResolvePath ( TemplateParameterFile ) ;
354
- if ( templateParameterFilePath != null && FileUtilities . DataStore . FileExists ( templateParameterFilePath ) )
361
+ if ( templateParameterFilePath != null )
355
362
{
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 =>
358
368
{
359
369
var parameter = new Hashtable ( ) ;
360
370
if ( dp . Value . Value != null )
@@ -366,18 +376,25 @@ protected Hashtable GetTemplateParameterObject(Hashtable templateParameterObject
366
376
parameter . Add ( "reference" , dp . Value . Reference ) ;
367
377
}
368
378
369
- prameterObject [ dp . Key ] = parameter ;
379
+ parameterObject [ dp . Key ] = parameter ;
370
380
} ) ;
371
- }
372
381
382
+ }
383
+ else
384
+ {
385
+ // To not break previous behavior, just output a warning.
386
+ WriteWarning ( "${templateParameterFilePath} does not exist" ) ;
387
+ }
388
+ }
389
+
373
390
// Load dynamic parameters
374
391
IEnumerable < RuntimeDefinedParameter > parameters = PowerShellUtilities . GetUsedDynamicParameters ( this . AsJobDynamicParameters , MyInvocation ) ;
375
392
if ( parameters . Any ( ) )
376
393
{
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 } } ) ;
378
395
}
379
396
380
- return prameterObject ;
397
+ return parameterObject ;
381
398
}
382
399
383
400
protected string GetDeploymentDebugLogLevel ( string deploymentDebugLogLevel )
0 commit comments