debian-forge/osbuild
Christian Kellner 5707c0a5b9 meta: proper error reporting for schema parsing
When parsing the module file, parse the JSON directly from the AST
node, because the AST node contains the line number of the schema
in the  module and thus we can resolve the correct line number for
errors  within the JSON. Convert the `JSONDecodeError` to a
`SyntaxError` which results in an overall better exception message:

Before:
Traceback (most recent call last):
  File "/workspaces/osbuild/osbuild/meta.py", line 331, in get_schema
    opts = self._make_options(version)
  [...]
  File "/usr/lib64/python3.9/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in
                              double quotes: line 2 column 1 (char 14)

After:
Traceback (most recent call last):
  File "/usr/lib64/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  [...]
    raise SyntaxError(msg, detail) from None
  File "stages/org.osbuild.ostree.init-fs", line 31
    additionalProperties: False
    ^
SyntaxError: Invalid schema: Expecting property name enclosed in ...
2021-06-07 17:55:00 +02:00
..
formats fmt/v1: correctly infer result from assembler 2021-03-09 21:40:47 +00:00
util sources/curl: Implement new way of getting RHSM secrets 2021-06-04 18:23:05 +01:00
__init__.py pipeline: remove Assembler class 2021-01-19 10:42:26 +01:00
__main__.py osbuild: always return exit code 2020-10-27 22:04:09 +01:00
api.py api: ensure parent of socket dir exists 2020-12-04 12:28:30 +01:00
buildroot.py buildroot: bind mount mke2fs config 2021-02-19 14:42:32 +00:00
inputs.py inputs: remove type info for info param 2021-02-06 12:04:30 +01:00
loop.py loop: use python 3 style base class initialization 2020-10-30 17:28:31 +01:00
main_cli.py main_cli: add --export command line argument 2021-02-12 15:55:43 +01:00
meta.py meta: proper error reporting for schema parsing 2021-06-07 17:55:00 +02:00
monitor.py monitor/log: print pipeline information 2021-02-12 15:55:43 +01:00
objectstore.py objectstore: add source method to api 2021-02-06 12:04:30 +01:00
pipeline.py pipeline: remove sources server 2021-04-29 12:58:01 +02:00
remoteloop.py api: remove 'addr' param from message dispatcher 2020-07-29 02:16:20 +01:00
sources.py sources: remove server and get method 2021-04-29 12:58:01 +02:00
treesum.py treesum: handle special device files 2021-02-16 23:00:13 +00:00