You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a project is created with a policies.yml file with formatting issues, a 500 error occurs when trying to visit the project page. This is the exception message in the server logs:
web-1 | File "/opt/scancodeio/.venv/lib/python3.12/site-packages/django/template/defaulttags.py", line 320, in render
web-1 | match = condition.eval(context)
web-1 | ^^^^^^^^^^^^^^^^^^^^^^^
web-1 | File "/opt/scancodeio/.venv/lib/python3.12/site-packages/django/template/defaulttags.py", line 886, in eval
web-1 | return self.value.resolve(context, ignore_failures=True)
web-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
web-1 | File "/opt/scancodeio/.venv/lib/python3.12/site-packages/django/template/base.py", line 718, in resolve
web-1 | obj = self.var.resolve(context)
web-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^
web-1 | File "/opt/scancodeio/.venv/lib/python3.12/site-packages/django/template/base.py", line 850, in resolve
web-1 | value = self._resolve_lookup(context)
web-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
web-1 | File "/opt/scancodeio/.venv/lib/python3.12/site-packages/django/template/base.py", line 893, in _resolve_lookup
web-1 | current = getattr(current, bit)
web-1 | ^^^^^^^^^^^^^^^^^^^^^
web-1 | File "/opt/scancodeio/scanpipe/models.py", line 1457, in policies_enabled
web-1 | return bool(self.policy_index)
web-1 | ^^^^^^^^^^^^^^^^^
web-1 | File "/opt/scancodeio/.venv/lib/python3.12/site-packages/django/utils/functional.py", line 47, in __get__
web-1 | res = instance.__dict__[self.name] = self.func(instance)
web-1 | ^^^^^^^^^^^^^^^^^^^
web-1 | File "/opt/scancodeio/scanpipe/models.py", line 1452, in policy_index
web-1 | return self.get_policy_index()
web-1 | ^^^^^^^^^^^^^^^^^^^^^^^
web-1 | File "/opt/scancodeio/scanpipe/models.py", line 1443, in get_policy_index
web-1 | policies_dict = policies.load_policies_file(policies_file)
web-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
web-1 | File "/opt/scancodeio/scanpipe/policies.py", line 41, in load_policies_file
web-1 | policies_dict = load_policies_yaml(policies_yaml=policies_file.read_text())
web-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
web-1 | File "/opt/scancodeio/scanpipe/policies.py", line 33, in load_policies_yaml
web-1 | raise ValidationError(f"Policies format error: {e}")
web-1 | django.core.exceptions.ValidationError: ['Policies format error: mapping values are not allowed in this context\n in "<unicode string>", line 53, column 43']
In the case where policies.yml is invalid, we should still be able to see the project page and a message should appear that there is an issue with policies.yml
The text was updated successfully, but these errors were encountered:
When a project is created with a
policies.yml
file with formatting issues, a 500 error occurs when trying to visit the project page. This is the exception message in the server logs:In the case where
policies.yml
is invalid, we should still be able to see the project page and a message should appear that there is an issue withpolicies.yml
The text was updated successfully, but these errors were encountered: