Spack: A corrupted packages.yaml causes 'spack config edit' to error out

Created on 3 Dec 2016  路  3Comments  路  Source: spack/spack

Adding an invalid key to one of the yaml files causes it to be un-editable by spack. For example:

>> spack config --scope defaults edit packages

packages:
  all:
    compiler: [gcc, intel, pgi, clang, xl, nag]
    providers:
      mpi: [openmpi, mpich]
      blas: [openblas]
      lapack: [openblas]
      pil: [py-pillow]

  openssl:
      paths:
          openssl@system: /usr
      version: [system]
      buildable: False
      **checksum: False**

Add the last, invalid key, save an exit.

Now try again

>> spack config --scope defaults edit packages

You will receive an error:

 Traceback (most recent call last):
  File "/home/tom/dev/spack/bin/spack", line 99, in <module>
    import spack
  File "/home/tom/dev/spack/lib/spack/spack/__init__.py", line 103, in <module>
    pkgsort = PreferredPackages()
  File "/home/tom/dev/spack/lib/spack/spack/preferred_packages.py", line 32, in __init__
    self.preferred = spack.config.get_config('packages')
  File "/home/tom/dev/spack/lib/spack/spack/config.py", line 398, in get_config
    data = scope.get_section(section)
  File "/home/tom/dev/spack/lib/spack/spack/config.py", line 177, in get_section
    data   = _read_config_file(path, schema)
  File "/home/tom/dev/spack/lib/spack/spack/config.py", line 272, in _read_config_file
    validate_section(data, schema)
  File "/home/tom/dev/spack/lib/spack/spack/config.py", line 149, in validate_section
    raise ConfigFormatError(e, data)
spack.config.ConfigFormatError: /home/tom/dev/spack/etc/spack/defaults/packages.yaml:25: Additional properties are not allowed ('checksum' was unexpected)

I think editing should be successful even if the config is invalid.

bug commands

Most helpful comment

Yes, I understand. But I think the interface is a little broken.

All 3 comments

Just use your editor directly...

Yes, I understand. But I think the interface is a little broken.

Confirmed. This happened to me recently.

Was this page helpful?
0 / 5 - 0 ratings