@@ -307,7 +307,7 @@ func loadOrCreateInstance(cmd *cobra.Command, args []string, createOnly bool) (*
307
307
return nil , err
308
308
}
309
309
} else {
310
- tmpl , err = limatmpl .Read (cmd . Context () , name , arg )
310
+ tmpl , err = limatmpl .Read (ctx , name , arg )
311
311
if err != nil {
312
312
return nil , err
313
313
}
@@ -321,7 +321,7 @@ func loadOrCreateInstance(cmd *cobra.Command, args []string, createOnly bool) (*
321
321
}
322
322
}
323
323
324
- if err := tmpl .Embed (cmd . Context () , true , true ); err != nil {
324
+ if err := tmpl .Embed (ctx , true , true ); err != nil {
325
325
return nil , err
326
326
}
327
327
yqExprs , err := editflags .YQExpressions (flags , true )
@@ -331,18 +331,18 @@ func loadOrCreateInstance(cmd *cobra.Command, args []string, createOnly bool) (*
331
331
yq := yqutil .Join (yqExprs )
332
332
if tty {
333
333
var err error
334
- tmpl , err = chooseNextCreatorState (cmd . Context () , tmpl , yq )
334
+ tmpl , err = chooseNextCreatorState (ctx , tmpl , yq )
335
335
if err != nil {
336
336
return nil , err
337
337
}
338
338
} else {
339
339
logrus .Info ("Terminal is not available, proceeding without opening an editor" )
340
- if err := modifyInPlace (tmpl , yq ); err != nil {
340
+ if err := modifyInPlace (ctx , tmpl , yq ); err != nil {
341
341
return nil , err
342
342
}
343
343
}
344
344
saveBrokenYAML := tty
345
- return instance .Create (cmd . Context () , tmpl .Name , tmpl .Bytes , saveBrokenYAML )
345
+ return instance .Create (ctx , tmpl .Name , tmpl .Bytes , saveBrokenYAML )
346
346
}
347
347
348
348
func applyYQExpressionToExistingInstance (ctx context.Context , inst * limatype.Instance , yq string ) (* limatype.Instance , error ) {
@@ -355,7 +355,7 @@ func applyYQExpressionToExistingInstance(ctx context.Context, inst *limatype.Ins
355
355
return nil , err
356
356
}
357
357
logrus .Debugf ("Applying yq expression %q to an existing instance %q" , yq , inst .Name )
358
- yBytes , err := yqutil .EvaluateExpression (yq , yContent )
358
+ yBytes , err := yqutil .EvaluateExpression (ctx , yq , yContent )
359
359
if err != nil {
360
360
return nil , err
361
361
}
@@ -381,8 +381,8 @@ func applyYQExpressionToExistingInstance(ctx context.Context, inst *limatype.Ins
381
381
return store .Inspect (ctx , inst .Name )
382
382
}
383
383
384
- func modifyInPlace (st * limatmpl.Template , yq string ) error {
385
- out , err := yqutil .EvaluateExpression (yq , st .Bytes )
384
+ func modifyInPlace (ctx context. Context , st * limatmpl.Template , yq string ) error {
385
+ out , err := yqutil .EvaluateExpression (ctx , yq , st .Bytes )
386
386
if err != nil {
387
387
return err
388
388
}
@@ -407,7 +407,7 @@ func (exitSuccessError) ExitCode() int {
407
407
408
408
func chooseNextCreatorState (ctx context.Context , tmpl * limatmpl.Template , yq string ) (* limatmpl.Template , error ) {
409
409
for {
410
- if err := modifyInPlace (tmpl , yq ); err != nil {
410
+ if err := modifyInPlace (ctx , tmpl , yq ); err != nil {
411
411
logrus .WithError (err ).Warn ("Failed to evaluate yq expression" )
412
412
return tmpl , err
413
413
}
0 commit comments