@@ -304,7 +304,7 @@ func loadOrCreateInstance(cmd *cobra.Command, args []string, createOnly bool) (*
304304 return nil , err
305305 }
306306 } else {
307- tmpl , err = limatmpl .Read (cmd . Context () , name , arg )
307+ tmpl , err = limatmpl .Read (ctx , name , arg )
308308 if err != nil {
309309 return nil , err
310310 }
@@ -318,7 +318,7 @@ func loadOrCreateInstance(cmd *cobra.Command, args []string, createOnly bool) (*
318318 }
319319 }
320320
321- if err := tmpl .Embed (cmd . Context () , true , true ); err != nil {
321+ if err := tmpl .Embed (ctx , true , true ); err != nil {
322322 return nil , err
323323 }
324324 yqExprs , err := editflags .YQExpressions (flags , true )
@@ -328,18 +328,18 @@ func loadOrCreateInstance(cmd *cobra.Command, args []string, createOnly bool) (*
328328 yq := yqutil .Join (yqExprs )
329329 if tty {
330330 var err error
331- tmpl , err = chooseNextCreatorState (cmd . Context () , tmpl , yq )
331+ tmpl , err = chooseNextCreatorState (ctx , tmpl , yq )
332332 if err != nil {
333333 return nil , err
334334 }
335335 } else {
336336 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 {
338338 return nil , err
339339 }
340340 }
341341 saveBrokenYAML := tty
342- return instance .Create (cmd . Context () , tmpl .Name , tmpl .Bytes , saveBrokenYAML )
342+ return instance .Create (ctx , tmpl .Name , tmpl .Bytes , saveBrokenYAML )
343343}
344344
345345func applyYQExpressionToExistingInstance (ctx context.Context , inst * store.Instance , yq string ) (* store.Instance , error ) {
@@ -352,7 +352,7 @@ func applyYQExpressionToExistingInstance(ctx context.Context, inst *store.Instan
352352 return nil , err
353353 }
354354 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 )
356356 if err != nil {
357357 return nil , err
358358 }
@@ -375,8 +375,8 @@ func applyYQExpressionToExistingInstance(ctx context.Context, inst *store.Instan
375375 return store .Inspect (ctx , inst .Name )
376376}
377377
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 )
380380 if err != nil {
381381 return err
382382 }
@@ -401,7 +401,7 @@ func (exitSuccessError) ExitCode() int {
401401
402402func chooseNextCreatorState (ctx context.Context , tmpl * limatmpl.Template , yq string ) (* limatmpl.Template , error ) {
403403 for {
404- if err := modifyInPlace (tmpl , yq ); err != nil {
404+ if err := modifyInPlace (ctx , tmpl , yq ); err != nil {
405405 logrus .WithError (err ).Warn ("Failed to evaluate yq expression" )
406406 return tmpl , err
407407 }
0 commit comments