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

Fix escape problem of double curly-braces in jinja2 template #85

Merged
merged 1 commit into from
Jun 27, 2022

Conversation

ciiiii
Copy link
Member

@ciiiii ciiiii commented Jun 27, 2022

Fix errors like this:

Traceback (most recent call last):
  File "/opt/homebrew/bin/j2", line 8, in <module>
    sys.exit(main())
  File "/opt/homebrew/lib/python3.9/site-packages/j2cli/cli.py", line 202, in main
    output = render_command(
  File "/opt/homebrew/lib/python3.9/site-packages/j2cli/cli.py", line 186, in render_command
    result = renderer.render(args.template, context)
  File "/opt/homebrew/lib/python3.9/site-packages/j2cli/cli.py", line 85, in render
    return self._env \
  File "/opt/homebrew/lib/python3.9/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/opt/homebrew/lib/python3.9/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "/path/to/apache-pulsar-grafana-dashboard/dashboards.template/zookeeper-3.6.json.j2", line 140, in top-level template code
    "legendFormat": "{{instance}} znode_count",
jinja2.exceptions.UndefinedError: 'instance' is undefinedTraceback (most recent call last):
  File "/opt/homebrew/bin/j2", line 8, in <module>
    sys.exit(main())
  File "/opt/homebrew/lib/python3.9/site-packages/j2cli/cli.py", line 202, in main
    output = render_command(
  File "/opt/homebrew/lib/python3.9/site-packages/j2cli/cli.py", line 186, in render_command
    result = renderer.render(args.template, context)
  File "/opt/homebrew/lib/python3.9/site-packages/j2cli/cli.py", line 85, in render
    return self._env \
  File "/opt/homebrew/lib/python3.9/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/opt/homebrew/lib/python3.9/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "/path/to/apache-pulsar-grafana-dashboard/dashboards.template/zookeeper-3.6.json.j2", line 140, in top-level template code
    "legendFormat": "{{instance}} znode_count",
jinja2.exceptions.UndefinedError: 'instance' is undefined

@ciiiii ciiiii requested review from codelipenghui and a team as code owners June 27, 2022 02:52
@ciiiii ciiiii requested a review from tuteng June 27, 2022 02:52
@ciiiii
Copy link
Member Author

ciiiii commented Jun 27, 2022

also referred in #66 (comment)

@ciiiii ciiiii merged commit 1c6c558 into master Jun 27, 2022
@ciiiii ciiiii deleted the yscai/zookeeper branch June 27, 2022 06:07
ericsyh pushed a commit that referenced this pull request Jul 25, 2023
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

Successfully merging this pull request may close these issues.

2 participants