diff options
author | Seth R. Johnson <johnsonsr@ornl.gov> | 2022-05-24 17:52:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-24 08:52:40 -0700 |
commit | 6a57aede571873f1dac2359dc3e6f430a1fcd900 (patch) | |
tree | 1213f2ea65f4c1c005a31012acbbc0fbd738541e /lib | |
parent | ba701a7cf8c60a85a317dcde63083fc76061c7d6 (diff) | |
download | spack-6a57aede571873f1dac2359dc3e6f430a1fcd900.tar.gz spack-6a57aede571873f1dac2359dc3e6f430a1fcd900.tar.bz2 spack-6a57aede571873f1dac2359dc3e6f430a1fcd900.tar.xz spack-6a57aede571873f1dac2359dc3e6f430a1fcd900.zip |
environments: fail gracefully on missing keys (#26378)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/environment/environment.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/spack/spack/environment/environment.py b/lib/spack/spack/environment/environment.py index 2536186b63..b275dd02f2 100644 --- a/lib/spack/spack/environment/environment.py +++ b/lib/spack/spack/environment/environment.py @@ -1619,7 +1619,14 @@ class Environment(object): """Return all specs, even those a user spec would shadow.""" all_specs = set() for h in self.concretized_order: - all_specs.update(self.specs_by_hash[h].traverse()) + try: + spec = self.specs_by_hash[h] + except KeyError: + tty.warn( + 'Environment %s appears to be corrupt: missing spec ' + '"%s"' % (self.name, h)) + continue + all_specs.update(spec.traverse()) return sorted(all_specs) |