summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2020-08-18 17:05:25 +0200
committerGitHub <noreply@github.com>2020-08-18 17:05:25 +0200
commit1ed70d0e2cc67de34850107f86ca4f16ba1d3c07 (patch)
treed662f7f79d5fa40dcbec7313ea2ac4e8ff39c642 /lib
parent319d160ed13ea2a034d22b7b2dafc55efaf93c2e (diff)
downloadspack-1ed70d0e2cc67de34850107f86ca4f16ba1d3c07.tar.gz
spack-1ed70d0e2cc67de34850107f86ca4f16ba1d3c07.tar.bz2
spack-1ed70d0e2cc67de34850107f86ca4f16ba1d3c07.tar.xz
spack-1ed70d0e2cc67de34850107f86ca4f16ba1d3c07.zip
'spack env update' can handle overrides (#18149)
fixes #18147 Before this commit the command erroneously reported "Additional properties not allowed" for keys with a double colon.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/environment.py2
-rw-r--r--lib/spack/spack/test/cmd/env.py20
2 files changed, 21 insertions, 1 deletions
diff --git a/lib/spack/spack/environment.py b/lib/spack/spack/environment.py
index 1423acbddb..ef9112a684 100644
--- a/lib/spack/spack/environment.py
+++ b/lib/spack/spack/environment.py
@@ -1787,7 +1787,7 @@ def update_yaml(manifest, backup_file):
shutil.copy(manifest, backup_file)
with open(manifest, 'w') as f:
- _write_yaml(data, f)
+ syaml.dump_config(data, f)
return True
diff --git a/lib/spack/spack/test/cmd/env.py b/lib/spack/spack/test/cmd/env.py
index 955693ca0f..26f0a10681 100644
--- a/lib/spack/spack/test/cmd/env.py
+++ b/lib/spack/spack/test/cmd/env.py
@@ -2112,3 +2112,23 @@ def test_old_format_cant_be_updated_implicitly(packages_yaml_v015):
env('activate', str(manifest.dirname))
with pytest.raises(spack.main.SpackCommandError):
add('hdf5')
+
+
+@pytest.mark.regression('18147')
+def test_can_update_attributes_with_override(tmpdir):
+ spack_yaml = """
+spack:
+ mirrors::
+ test: /foo/bar
+ packages:
+ cmake:
+ paths:
+ cmake@3.18.1: /usr
+ specs:
+ - hdf5
+"""
+ abspath = tmpdir.join('spack.yaml')
+ abspath.write(spack_yaml)
+
+ # Check that an update does not raise
+ env('update', '-y', str(abspath.dirname))