summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2016-01-17 19:55:20 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2016-01-19 01:16:14 -0800
commitad32f64ef6120ab2bc9da739f3032b2ba304a2f0 (patch)
treedbba4105fe619f68e7cff27691dd0fb91c26c845 /lib
parent8d6342c53d91f302204d0bbb54f06978a6de26a7 (diff)
downloadspack-ad32f64ef6120ab2bc9da739f3032b2ba304a2f0.tar.gz
spack-ad32f64ef6120ab2bc9da739f3032b2ba304a2f0.tar.bz2
spack-ad32f64ef6120ab2bc9da739f3032b2ba304a2f0.tar.xz
spack-ad32f64ef6120ab2bc9da739f3032b2ba304a2f0.zip
Allow completely empty config files.
- Previous version would give validation error for an empty file. Now this is properly ignored. - Also includes bugfix in ConfigFormatError
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/config.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/spack/spack/config.py b/lib/spack/spack/config.py
index 193b311434..6fecde9980 100644
--- a/lib/spack/spack/config.py
+++ b/lib/spack/spack/config.py
@@ -357,8 +357,8 @@ def _read_config_file(filename, schema):
with open(filename) as f:
data = syaml.load(f)
- validate_section(data, schema)
-
+ if data:
+ validate_section(data, schema)
return data
except MarkedYAMLError, e:
@@ -514,7 +514,7 @@ class ConfigFormatError(ConfigError):
# Try really hard to get the parent (which sometimes is not
# set) This digs it out of the validated structure if it's not
# on the validation_error.
- if not parent_mark:
+ if path and not parent_mark:
parent_path = list(path)[:-1]
parent = get_path(parent_path, data)
if path[-1] in parent: