From: Zack Cerza Date: Mon, 31 Mar 2014 14:57:19 +0000 (-0500) Subject: Provide real error messages for unfound (sub)tasks X-Git-Tag: 1.1.0~1553 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4efb57d3bdc2ac880c58b645082a05c110cb5cb7;p=teuthology.git Provide real error messages for unfound (sub)tasks Signed-off-by: Zack Cerza --- diff --git a/teuthology/run_tasks.py b/teuthology/run_tasks.py index 0796c304c..84936b355 100644 --- a/teuthology/run_tasks.py +++ b/teuthology/run_tasks.py @@ -14,8 +14,16 @@ def run_one_task(taskname, **kwargs): if '.' in taskname: (submod, subtask) = taskname.rsplit('.', 1) parent = __import__('teuthology.task', globals(), locals(), [submod], 0) - mod = getattr(parent, submod) - fn = getattr(mod, subtask) + try: + mod = getattr(parent, submod) + except AttributeError: + log.error("No task named %s was found", submod) + raise + try: + fn = getattr(mod, subtask) + except AttributeError: + log.error("No subtask of %s named %s was found", mod, subtask) + raise return fn(**kwargs)