]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
run_tasks: catch malformed task case
authorJohn Spray <jspray@redhat.com>
Wed, 2 Jul 2014 18:09:03 +0000 (19:09 +0100)
committerJohn Spray <jspray@redhat.com>
Thu, 3 Jul 2014 15:09:29 +0000 (16:09 +0100)
If you do something like this:

- foo:
- bar:
- baz

Then catching AttributeError is necessary for giving a somewhat
friendlier error on the 'baz' where we have a string instead
of a dict.

Signed-off-by: John Spray <john.spray@redhat.com>
teuthology/run_tasks.py

index 99158ff2cdc3dcbdff04dc6088d8468144a8e88f..ada99d0256795ba545ab8a2364ac729f33c75002 100644 (file)
@@ -37,7 +37,7 @@ def run_tasks(tasks, ctx):
         for taskdict in tasks:
             try:
                 ((taskname, config),) = taskdict.iteritems()
-            except ValueError:
+            except (ValueError, AttributeError):
                 raise RuntimeError('Invalid task definition: %s' % taskdict)
             log.info('Running task %s...', taskname)
             manager = run_one_task(taskname, ctx=ctx, config=config)