Skip to content

Commit

Permalink
Merge pull request #672 from boegel/sanity_check_msg_exts
Browse files Browse the repository at this point in the history
make sure clear message is shown as to why extension sanity check fails
  • Loading branch information
boegel committed Aug 5, 2013
2 parents 08f31e0 + 2c9a4ef commit 1512a02
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
5 changes: 3 additions & 2 deletions easybuild/framework/easyblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,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 @@ -1443,8 +1446,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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 1512a02

Please sign in to comment.