Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make sure clear message is shown as to why extension sanity check fails #672

Merged
merged 1 commit into from Aug 5, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions easybuild/framework/easyblock.py
Expand Up @@ -147,6 +147,9 @@ def __init__(self, path, debug=False, robot_path=None, validate_ec=True):
# iterate configure/build/options
self.iter_opts = {}

# sanity check fail error messages to report (if any)
self.sanity_check_fail_msgs = []

self.log.info("Init completed for application name %s version %s" % (self.name, self.version))


Expand Down Expand Up @@ -1437,8 +1440,6 @@ def sanity_check_step(self, custom_paths=None, custom_commands=None, extension=F
self.log.error("Incorrect format for sanity_check_paths (should only have 'files' and 'dirs' keys, " \
"values should be lists (at least one non-empty)).")

self.sanity_check_fail_msgs = []

# check if files exist
for f in paths['files']:
p = os.path.join(self.installdir, f)
Expand Down
12 changes: 6 additions & 6 deletions easybuild/framework/extension.py
Expand Up @@ -132,7 +132,6 @@ def sanity_check_step(self):
if modname == False:
# allow skipping of sanity check by setting module name to False
return True

else:
template = {
'ext_name': modname,
Expand All @@ -146,15 +145,16 @@ def sanity_check_step(self):
}
cmd = cmd % template

stdin = None
if inp:
stdin = inp % template
# set log_ok to False so we can catch the error instead of run_cmd
(output, ec) = run_cmd(cmd, log_ok=False, simple=False, inp=stdin, regexp=False)
else:
(output, ec) = run_cmd(cmd, log_ok=False, simple=False, regexp=False)
# set log_ok to False so we can catch the error instead of run_cmd
(output, ec) = run_cmd(cmd, log_ok=False, simple=False, regexp=False)

if ec:
self.log.warn("Extension: %s failed to install! (output: %s)" % (self.name, output))
msg = "%s failed to install, cmd '%s' (stdin: %s) output: %s" % (self.name, cmd, stdin, output)
self.log.warn("Extension: %s" % msg)
self.sanity_check_fail_msgs.append(msg)
return False
else:
return True
5 changes: 3 additions & 2 deletions easybuild/framework/extensioneasyblock.py
Expand Up @@ -119,10 +119,11 @@ def sanity_check_step(self, exts_filter=None, custom_paths=None, custom_commands

# pass or fail sanity check
if not sanity_check_ok:
msg = "Sanity check for %s failed: %s" % (self.name, '; '.join(self.sanity_check_fail_msgs))
if self.is_extension:
self.log.warning("Sanity check for %s failed!" % self.name)
self.log.warning(msg)
else:
self.log.error("Sanity check for %s failed!" % self.name)
self.log.error(msg)
return False
else:
self.log.info("Sanity check for %s successful!" % self.name)
Expand Down