diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2019-01-01 09:11:49 +0100 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2019-01-01 00:11:49 -0800 |
commit | 3b8b13809e4f9e8d7456c4d2e27d7ff069c8e44e (patch) | |
tree | 780912907d33c87d1756a782156ddae9e93cd029 /COPYRIGHT | |
parent | e6b2f0c1791e82beba548458b93564a0cd97b32b (diff) | |
download | spack-3b8b13809e4f9e8d7456c4d2e27d7ff069c8e44e.tar.gz spack-3b8b13809e4f9e8d7456c4d2e27d7ff069c8e44e.tar.bz2 spack-3b8b13809e4f9e8d7456c4d2e27d7ff069c8e44e.tar.xz spack-3b8b13809e4f9e8d7456c4d2e27d7ff069c8e44e.zip |
Improve validation of modules.yaml (#9878)
This PR improves the validation of `modules.yaml` by introducing a custom validator that checks if an attribute listed in `properties` or `patternProperties` is a valid spec. This new check applied to the test case in #9857 gives:
```console
$ spack install szip
==> Error: /home/mculpo/.spack/linux/modules.yaml:5: "^python@2.7@" is an invalid spec [Invalid version specifier]
```
Details:
* Moved the set-up of a custom validator class to spack.schema
* In Spack we use `jsonschema` to validate configuration files
against a schema. We also need custom validators to enforce
writing default values within "properties" or "patternProperties"
attributes.
* Currently, validators were customized at the place of use and with the
recent introduction of environments that meant we were setting-up and
using 2 different validator classes in two different modules.
* This commit moves the set-up of a custom validator class in the
`spack.schema` module and refactors the code in `spack.config` and
`spack.environments` to use it.
* Added a custom validator to check if an attribute is a valid spec
* Added a custom validator that can be used on objects, which yields an
error if the attribute is not a valid spec.
* Updated the schema for modules.yaml
* Updated modules.yaml to fix a few inconsistencies:
- a few attributes were not tested properly using 'anyOf'
- suffixes has been updated to also check that the attribute is a spec
- hierarchical_scheme has been updated to hierarchy
* Removed $ref from every schema
* $ref is not composable or particularly legible
* Use python dicts and regular old variables instead.
Diffstat (limited to 'COPYRIGHT')
0 files changed, 0 insertions, 0 deletions