Closed ctothew closed 2 years ago
Hi @ctothew, thanks for filing this issue.
I think the problem is with Jinja2 being in 2.x; the templates use a function (indent
) in a way that is supported only starting from 3.x.
I’m now running a CI/CD job to test some changes I did in the application’s requirements, so that Jinja2 3.x will be required in the installation phase. If that’s successful I’ll release an update in the next few days.
In the meantime you can try to upgrade the Jinja2 package in the virtual env you use for ARouteServer; that should work.
Hi There I've currently found some issues on arouteserver and it's dependencies to jinja2.
I'm using: MarkupSafe - Version 1.1.1 Jinja2 - Version: 2.11.3 Arouteserver - Version 1.15.0
The applications in this combination lead to an unexpected break at the end of the bgpd template building:
ARouteServer 2022-05-12 16:06:25,210 ERROR Error while rendering template: can't multiply sequence by non-int of type 'str'
File "/root/.virtualenvs/arouteserver/lib/python3.7/site-packages/pierky/arouteserver/builder.py", line 761, in render_template for buf in tpl.generate(self.data):
File "/root/.virtualenvs/arouteserver/lib/python3.7/site-packages/jinja2/environment.py", line 1125, in generate yield self.environment.handle_exception()
File "/root/.virtualenvs/arouteserver/lib/python3.7/site-packages/jinja2/environment.py", line 832, in handle_exception reraise(*rewrite_traceback_stack(source=source))
File "/root/.virtualenvs/arouteserver/lib/python3.7/site-packages/jinja2/_compat.py", line 28, in reraise raise value.with_traceback(tb)
File "/root/arouteserver/templates/openbgpd/main.j2", line 10, in top-level template code {% include "clients.j2" %}
File "/root/arouteserver/templates/openbgpd/clients.j2", line 91, in top-level template code {{- write_custom_config_lines(client, "ipv" ~ client.ip|ipaddr_ver, "client")|indent(" ") }}
File "/root/.virtualenvs/arouteserver/lib/python3.7/site-packages/jinja2/filters.py", line 642, in do_indent indention = u" " width Traceback (most recent call last): File "/root/.virtualenvs/arouteserver/lib/python3.7/site-packages/pierky/arouteserver/builder.py", line 761, in render_template for buf in tpl.generate(self.data): File "/root/.virtualenvs/arouteserver/lib/python3.7/site-packages/jinja2/environment.py", line 1125, in generate yield self.environment.handle_exception() File "/root/.virtualenvs/arouteserver/lib/python3.7/site-packages/jinja2/environment.py", line 832, in handle_exception reraise(rewrite_traceback_stack(source=source)) File "/root/.virtualenvs/arouteserver/lib/python3.7/site-packages/jinja2/_compat.py", line 28, in reraise raise value.with_traceback(tb) File "/root/arouteserver/templates/openbgpd/main.j2", line 10, in top-level template code {% include "clients.j2" %} File "/root/arouteserver/templates/openbgpd/clients.j2", line 91, in top-level template code {{- write_custom_config_lines(client, "ipv" ~ client.ip|ipaddr_ver, "client")|indent(" ") }} File "/root/.virtualenvs/arouteserver/lib/python3.7/site-packages/jinja2/filters.py", line 642, in do_indent indention = u" " * width TypeError: can't multiply sequence by non-int of type 'str'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/root/.virtualenvs/arouteserver/bin/arouteserver", line 64, in
if main():
File "/root/.virtualenvs/arouteserver/bin/arouteserver", line 53, in main
return cmd.run()
File "/root/.virtualenvs/arouteserver/lib/python3.7/site-packages/pierky/arouteserver/commands/tpl_rendering.py", line 184, in run
raise e
File "/root/.virtualenvs/arouteserver/lib/python3.7/site-packages/pierky/arouteserver/commands/tpl_rendering.py", line 179, in run
builder.render_template(output_file=self.args.output_file)
File "/root/.virtualenvs/arouteserver/lib/python3.7/site-packages/pierky/arouteserver/builder.py", line 769, in render_template
traceback=traceback
pierky.arouteserver.errors.TemplateRenderingError: Error while rendering template: can't multiply sequence by non-int of type 'str'