Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow disabling recipe interpolation #735

Closed
FlatMapIO opened this issue Dec 5, 2020 · 4 comments
Closed

Allow disabling recipe interpolation #735

FlatMapIO opened this issue Dec 5, 2020 · 4 comments

Comments

@FlatMapIO
Copy link

There are many tools that use go-template to get field values, such as
kubectl get secret nfluxdb2-auth -n monitoring --template={{index .data "admin-password"}} | base64 -d
which are difficult to render with the escept.

I tried {{ '{{index .data "admin-password"}}' }}
and "{{" '{{index .data "admin-password"}}' "}}"
that didn't work properly

@casey casey changed the title Provides a method to mute substitution on command start Allow disabling recipe interpolation Dec 5, 2020
@casey casey reopened this Dec 5, 2020
@casey
Copy link
Owner

casey commented Dec 5, 2020

Did you get this working?

I think you'll need another set of single quotes:

foo:
  kubectl get secret nfluxdb2-auth -n monitoring --template=--template='{{ '{{index .data "admin-password"}}' }}' | base64 -d

I think it would be good to be able to disable interpolation in individual recipes. It would probably need attributes, as proposed #604. It might be hard though, since the lexer would need to be know when it was lexing a recipe without interpolation.

@FlatMapIO
Copy link
Author

I finally got the right result, but I think it's an inelegant solution, and in a complex scenario, the expression becomes extremely difficult to read.

kubectl get secret influxdb2-auth -n monitoring --template='{{'{{index .data "admin-password"}}'}}' | base64 -d

@casey
Copy link
Owner

casey commented Dec 6, 2020

I agree, it's definitely not very nice, and ideally could be improved.

@casey
Copy link
Owner

casey commented Mar 25, 2021

I just released v0.8.5, which allows escaping a {{ by writing {{{{, so this should be much better now.

@casey casey closed this as completed Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants