bugfix: spack config get <section> in environments

`spack config get <section>` was erroneously returning just the `spack.yaml`
for the environment.

It should return the combined configuration for that section (including
anything from `spack.yaml`), even in an environment.

- [x] reorder conditions in `cmd/config.py` to fix
This commit is contained in:
Todd Gamblin 2021-07-03 12:07:26 -07:00 committed by Peter Scheibel
parent 2bd513d659
commit 374e3465c5

View File

@ -143,7 +143,10 @@ def config_get(args):
"""
scope, section = _get_scope_and_section(args)
if scope and scope.startswith('env:'):
if section is not None:
spack.config.config.print_section(section)
elif scope and scope.startswith('env:'):
config_file = spack.config.config.get_config_filename(scope, section)
if os.path.exists(config_file):
with open(config_file) as f:
@ -151,9 +154,6 @@ def config_get(args):
else:
tty.die('environment has no %s file' % ev.manifest_name)
elif section is not None:
spack.config.config.print_section(section)
else:
tty.die('`spack config get` requires a section argument '
'or an active environment.')