qwc-services/qwc-config-generator

Could not load JSON schema versions

benoitblanc opened this issue · 4 comments

With image v2023.1-lts, I have an error when I try to generate configuration from container with command:

root@cd1e66416b67:/srv/qwc_service# python3 config_generator_cli.py ./config-in/default/tenantConfig.json all

Here are the logs:

QWC ConfigGenerator
[2023-03-09 09:21:19.705017] DEBUG: Using tenant 'default'
[2023-03-09 09:21:19.705046] INFO: Config destination: '/srv/qwc_service/config-out/default'
/usr/local/lib/python3.8/dist-packages/qwc_services_core/config_models.py:195: SAWarning: Property registration_requests.user on mapped class registration_requests->registration_requests being replaced with new property registration_requests.user; the old property will be discarded
  RegistrationRequest.user = relationship(
[2023-03-09 09:21:19.851558] DEBUG: The qgis_projects sub directory does not exist: /srv/qwc_service/config-in/default/qgis_projects
[2023-03-09 09:21:19.851607] INFO: Searching for projects files in /data/scan
[2023-03-09 09:21:19.851740] ERROR: Could not load JSON schema versions from /srv/qwc_service/config_generator/../schemas/schema-versions.json:
[Errno 2] No such file or directory: '/srv/qwc_service/config_generator/../schemas/schema-versions.json'
Traceback (most recent call last):
  File "/srv/qwc_service/config_generator/config_generator.py", line 203, in __init__
    with open(schema_versions_path) as f:
FileNotFoundError: [Errno 2] No such file or directory: '/srv/qwc_service/config_generator/../schemas/schema-versions.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "config_generator_cli.py", line 60, in <module>
    generator = ConfigGenerator(config, logger)
  File "/srv/qwc_service/config_generator/config_generator.py", line 211, in __init__
    raise Exception(msg)
Exception: Could not load JSON schema versions from /srv/qwc_service/config_generator/../schemas/schema-versions.json:
[Errno 2] No such file or directory: '/srv/qwc_service/config_generator/../schemas/schema-versions.json'

The problem is in config_generator.py when searching for schemas-versions.json file in parent directory.

I am also wondering if this step is needed when validate_schema is false in tenantConfig file ? Is it not handled for now.

I can not resolve this one by pushing a PR for now, but I'll try to do it in the next days if you can not. Please, just answer my previous question to know how to handle it :-).

Thanks

@pka the problem is to handle branch name, as it was done here 5052459

What is the best way to do it ? Environment variable JSON_SCHEMAS_VERSION or an option in config-generator configuration ?

mwa commented

Fixed in 27806d4 (v2023.2-lts, v2023.03.09)

The schema-versions.json is used during config generation to assign the same schema URLs to the $schema headers in all generated service configs. This is always done, even if validate_schema is false.

Thanks !