Skip to content

[Bug] Need to log but continue on template errors #511

@stewartshea

Description

@stewartshea

Observation
The following type of error causes discovery / rendering to halt. We need to log and continue.

Rendering output item: workspaces/b-sandbox/slxs/odo-od-grnsucsc1c-k8s-otlcllc-ba1046ff/slx.yaml
  File "/workspace-builder/workspace_builder/views.py", line 99, in post
    run_components(context, components)

  File "/workspace-builder/component.py", line 356, in run_components
    component.run_func(context)

  File "/workspace-builder/renderers/render_output_items.py", line 55, in render
    output_text = render_template_file(output_item.template_name,
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/workspace-builder/template.py", line 83, in render_template_file
    raise WorkspaceBuilderException(message) from e

Caused by:

  File "/workspace-builder/template.py", line 74, in render_template_file
    template = env.get_template(template_file_name)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/opt/pysetup/.venv/lib/python3.11/site-packages/jinja2/environment.py", line 1013, in get_template
    return self._load_template(name, globals)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/opt/pysetup/.venv/lib/python3.11/site-packages/jinja2/environment.py", line 972, in _load_template
    template = self.loader.load(self, name, self.make_globals(globals))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/opt/pysetup/.venv/lib/python3.11/site-packages/jinja2/loaders.py", line 578, in load
    raise TemplateNotFound(name)

Internal Server Error: /run/
[30/Jul/2024 13:11:35] "POST /run/ HTTP/1.1" 500 16935
Error 500 from Workspace Builder service for command "run": Error opening template file: k8s-otelcollector-slx.yaml
10.107.160.6 - - [30/Jul/2024:13:11:51 +0000] "GET / HTTP/1.1" 200 35130 "-" "curl/7.88.1"
10.128.0.94 - - [30/Jul/2024:13:11:54 +0000] "GET / HTTP/1.1" 200 35130 "-" "kube-probe/1.27"

Possible Suggestions
Log and continue. This is an issue with a codecollection repository template which shouldn't cause discovery to fail.

Any other details or context

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions