Skip to content

Commit 5a41961

Browse files
committed
Cleaned up the logic, there were two checks that caught cases where no top level item was specified in the YAML
1 parent a28e15a commit 5a41961

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

easybuild/framework/easystack.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,19 +141,16 @@ def parse(filepath):
141141
msg = "Specifying multiple top level keys (%s) in one EasyStack file is not supported." % keys_string
142142
raise EasyBuildError(msg)
143143
elif len(keys_found) == 0:
144-
raise EasyBuildError("An EasyStack file needs to contain at least one of the keys: %s" % (top_keys,))
144+
msg = "Not a valid EasyStack YAML file: no 'easyconfigs' or 'software' top-level key found"
145+
raise EasyBuildError(msg)
145146
else:
146147
key = keys_found[0]
147148
easystack_data = easystack_raw[key]
148149

149-
if easystack_data is None:
150-
msg = "Not a valid EasyStack YAML file: no 'easyconfigs' or 'software' top-level key found"
151-
raise EasyBuildError(msg)
152-
else:
153-
parse_method_name = 'parse_by_' + key
154-
parse_method = getattr(EasyStackParser, 'parse_by_%s' % key, None)
155-
if parse_method is None:
156-
raise EasyBuildError("Easystack parse method '%s' not found!", parse_method_name)
150+
parse_method_name = 'parse_by_' + key
151+
parse_method = getattr(EasyStackParser, 'parse_by_%s' % key, None)
152+
if parse_method is None:
153+
raise EasyBuildError("Easystack parse method '%s' not found!", parse_method_name)
157154

158155
# assign general easystack attributes
159156
easybuild_version = easystack_raw.get('easybuild_version', None)

0 commit comments

Comments
 (0)