I ran into the following error with kubernetes_validate version 1.20.0 in an environment that is using python 2.7 (I do realize python 2.7 is not "officially" supported any longer...)
Traceback (most recent call last):
File "/usr/local/bin/kubernetes-validate", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/site-packages/kubernetes_validate/__main__.py", line 50, in main
utils.validate(resource, version, args.strict)
File "/usr/local/lib/python2.7/site-packages/kubernetes_validate/utils.py", line 77, in validate
jsonschema.validate(data, schema, resolver=resolver)
File "/usr/local/lib/python2.7/site-packages/jsonschema/validators.py", line 932, in validate
error = exceptions.best_match(validator.iter_errors(instance))
File "/usr/local/lib/python2.7/site-packages/jsonschema/exceptions.py", line 367, in best_match
best = next(errors, None)
File "/usr/local/lib/python2.7/site-packages/jsonschema/validators.py", line 328, in iter_errors
for error in errors:
File "/usr/local/lib/python2.7/site-packages/jsonschema/_validators.py", line 259, in ref
scope, resolved = validator.resolver.resolve(ref)
File "/usr/local/lib/python2.7/site-packages/jsonschema/validators.py", line 766, in resolve
return url, self._remote_cache(url)
File "/usr/local/lib/python2.7/site-packages/functools32/functools32.py", line 400, in wrapper
result = user_function(*args, **kwds)
File "/usr/local/lib/python2.7/site-packages/jsonschema/validators.py", line 779, in resolve_from_url
raise exceptions.RefResolutionError(exc)
jsonschema.exceptions.RefResolutionError: <urlopen error [Errno 2] No such file or directory: '/local/lib/python2.7/site-packages/kubernetes_validate/kubernetes-json-schema/v1.21.0-local/_definitions.json'>
The above error was produced with the following command run from the root directory of the repo
I ran into the following error with kubernetes_validate version 1.20.0 in an environment that is using python 2.7 (I do realize python 2.7 is not "officially" supported any longer...)
The above error was produced with the following command run from the root directory of the repo
Version 1.19.0 does not have this issue. The bug looks to have been introduced by https://github.com/willthames/kubernetes-validate/commit/06dbf5328ffad319c2f34650face591427e2589c#diff-944d057cf1c21162526aada56b570f35793f7569e1085903acd1b14334a0f756 and the following change fixes it
The change also works on python3.