@@ -304,7 +304,7 @@ func loadOrCreateInstance(cmd *cobra.Command, args []string, createOnly bool) (*
304
304
return nil , err
305
305
}
306
306
} else {
307
- tmpl , err = limatmpl .Read (cmd . Context () , name , arg )
307
+ tmpl , err = limatmpl .Read (ctx , name , arg )
308
308
if err != nil {
309
309
return nil , err
310
310
}
@@ -318,7 +318,7 @@ func loadOrCreateInstance(cmd *cobra.Command, args []string, createOnly bool) (*
318
318
}
319
319
}
320
320
321
- if err := tmpl .Embed (cmd . Context () , true , true ); err != nil {
321
+ if err := tmpl .Embed (ctx , true , true ); err != nil {
322
322
return nil , err
323
323
}
324
324
yqExprs , err := editflags .YQExpressions (flags , true )
@@ -328,18 +328,18 @@ func loadOrCreateInstance(cmd *cobra.Command, args []string, createOnly bool) (*
328
328
yq := yqutil .Join (yqExprs )
329
329
if tty {
330
330
var err error
331
- tmpl , err = chooseNextCreatorState (cmd . Context () , tmpl , yq )
331
+ tmpl , err = chooseNextCreatorState (ctx , tmpl , yq )
332
332
if err != nil {
333
333
return nil , err
334
334
}
335
335
} else {
336
336
logrus .Info ("Terminal is not available, proceeding without opening an editor" )
337
- if err := modifyInPlace (tmpl , yq ); err != nil {
337
+ if err := modifyInPlace (ctx , tmpl , yq ); err != nil {
338
338
return nil , err
339
339
}
340
340
}
341
341
saveBrokenYAML := tty
342
- return instance .Create (cmd . Context () , tmpl .Name , tmpl .Bytes , saveBrokenYAML )
342
+ return instance .Create (ctx , tmpl .Name , tmpl .Bytes , saveBrokenYAML )
343
343
}
344
344
345
345
func applyYQExpressionToExistingInstance (ctx context.Context , inst * store.Instance , yq string ) (* store.Instance , error ) {
@@ -352,7 +352,7 @@ func applyYQExpressionToExistingInstance(ctx context.Context, inst *store.Instan
352
352
return nil , err
353
353
}
354
354
logrus .Debugf ("Applying yq expression %q to an existing instance %q" , yq , inst .Name )
355
- yBytes , err := yqutil .EvaluateExpression (yq , yContent )
355
+ yBytes , err := yqutil .EvaluateExpression (ctx , yq , yContent )
356
356
if err != nil {
357
357
return nil , err
358
358
}
@@ -375,8 +375,8 @@ func applyYQExpressionToExistingInstance(ctx context.Context, inst *store.Instan
375
375
return store .Inspect (ctx , inst .Name )
376
376
}
377
377
378
- func modifyInPlace (st * limatmpl.Template , yq string ) error {
379
- out , err := yqutil .EvaluateExpression (yq , st .Bytes )
378
+ func modifyInPlace (ctx context. Context , st * limatmpl.Template , yq string ) error {
379
+ out , err := yqutil .EvaluateExpression (ctx , yq , st .Bytes )
380
380
if err != nil {
381
381
return err
382
382
}
@@ -401,7 +401,7 @@ func (exitSuccessError) ExitCode() int {
401
401
402
402
func chooseNextCreatorState (ctx context.Context , tmpl * limatmpl.Template , yq string ) (* limatmpl.Template , error ) {
403
403
for {
404
- if err := modifyInPlace (tmpl , yq ); err != nil {
404
+ if err := modifyInPlace (ctx , tmpl , yq ); err != nil {
405
405
logrus .WithError (err ).Warn ("Failed to evaluate yq expression" )
406
406
return tmpl , err
407
407
}
0 commit comments