• Kirill Smelkov's avatar
    software/ors-amarisoft: Fix json-schemas complain about missing response schemas · 3cf7a509
    Kirill Smelkov authored
    As explained in the previous patch now once we have software.cfg and
    software.cfg.json, json-schemas started to analyze them instead of skipping
    software/ors-amarisoft/ completely, and it started to complain about missing
    response schemas, for example:
    
        ERROR: test_ors-amarisoft_software_cfg_json (slapos.test.test_json_schema.TestJSONSchemaValidation)
        ----------------------------------------------------------------------
        Traceback (most recent call last):
          File "/srv/slapgrid/slappart91/srv/runner/software/45a1e838784afb18daf420009d925c78/eggs/jsonschema-4.17.3-py3.9.egg/jsonschema/validators.py", line 909, in resolve_from_url
            document = self.store[url]
          File "/srv/slapgrid/slappart91/srv/runner/software/45a1e838784afb18daf420009d925c78/eggs/jsonschema-4.17.3-py3.9.egg/jsonschema/_utils.py", line 28, in __getitem__
            return self.store[self.normalize(uri)]
        KeyError: 'file:///srv/slapgrid/slappart91/srv/project/slapos/software/ors-amarisoft/instance-ue-schema.json'
    
        During handling of the above exception, another exception occurred:
    
        Traceback (most recent call last):
          File "/srv/slapgrid/slappart91/srv/runner/shared/python3/dd8479ce2a2b9dff51f7185535dd0403/lib/python3.9/urllib/request.py", line 1503, in open_local_file
            stats = os.stat(localfile)
        FileNotFoundError: [Errno 2] No such file or directory: '/srv/slapgrid/slappart91/srv/project/slapos/software/ors-amarisoft/instance-ue-schema.json'
    
        During handling of the above exception, another exception occurred:
    
        Traceback (most recent call last):
          File "/srv/slapgrid/slappart91/srv/runner/software/45a1e838784afb18daf420009d925c78/eggs/jsonschema-4.17.3-py3.9.egg/jsonschema/validators.py", line 912, in resolve_from_url
            document = self.resolve_remote(url)
          File "/srv/slapgrid/slappart91/srv/runner/software/45a1e838784afb18daf420009d925c78/eggs/jsonschema-4.17.3-py3.9.egg/jsonschema/validators.py", line 1018, in resolve_remote
            with urlopen(uri) as url:
          File "/srv/slapgrid/slappart91/srv/runner/shared/python3/dd8479ce2a2b9dff51f7185535dd0403/lib/python3.9/urllib/request.py", line 214, in urlopen
            return opener.open(url, data, timeout)
          File "/srv/slapgrid/slappart91/srv/runner/shared/python3/dd8479ce2a2b9dff51f7185535dd0403/lib/python3.9/urllib/request.py", line 517, in open
            response = self._open(req, data)
          File "/srv/slapgrid/slappart91/srv/runner/shared/python3/dd8479ce2a2b9dff51f7185535dd0403/lib/python3.9/urllib/request.py", line 534, in _open
            result = self._call_chain(self.handle_open, protocol, protocol +
          File "/srv/slapgrid/slappart91/srv/runner/shared/python3/dd8479ce2a2b9dff51f7185535dd0403/lib/python3.9/urllib/request.py", line 494, in _call_chain
            result = func(*args)
          File "/srv/slapgrid/slappart91/srv/runner/shared/python3/dd8479ce2a2b9dff51f7185535dd0403/lib/python3.9/urllib/request.py", line 1481, in file_open
            return self.open_local_file(req)
          File "/srv/slapgrid/slappart91/srv/runner/shared/python3/dd8479ce2a2b9dff51f7185535dd0403/lib/python3.9/urllib/request.py", line 1520, in open_local_file
            raise URLError(exp)
        urllib.error.URLError: <urlopen error [Errno 2] No such file or directory: '/srv/slapgrid/slappart91/srv/project/slapos/software/ors-amarisoft/instance-ue-schema.json'>
    
        During handling of the above exception, another exception occurred:
    
        Traceback (most recent call last):
          File "/srv/slapgrid/slappart91/srv/project/slapos/slapos/test/test_json_schema.py", line 72, in run
            resolver.resolve(software_type_definition['response'])
          File "/srv/slapgrid/slappart91/srv/runner/software/45a1e838784afb18daf420009d925c78/eggs/jsonschema-4.17.3-py3.9.egg/jsonschema/validators.py", line 898, in resolve
            return url, self._remote_cache(url)
          File "/srv/slapgrid/slappart91/srv/runner/software/45a1e838784afb18daf420009d925c78/eggs/jsonschema-4.17.3-py3.9.egg/jsonschema/validators.py", line 914, in resolve_from_url
            raise exceptions.RefResolutionError(exc)
        jsonschema.exceptions.RefResolutionError: <urlopen error [Errno 2] No such file or directory: '/srv/slapgrid/slappart91/srv/project/slapos/software/ors-amarisoft/instance-ue-schema.json'>
    
    -> Fix this and all other similar errors by adding stub response schemas for all objects that is possible to instantiate.
    3cf7a509
instance-enb-schema.json 162 Bytes