]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Further clarify 'too many values to unpack' error. 253/head
authorWarren Usui <warren.usui@inktank.com>
Wed, 7 May 2014 21:05:56 +0000 (14:05 -0700)
committerWarren Usui <warren.usui@inktank.com>
Thu, 8 May 2014 17:57:06 +0000 (10:57 -0700)
Many errors in yaml configurations cause ValueError to get thrown
with the message 'too many values to unpack.'  A previously reverted
change tried to handle all these situations and print an appropriate
message.

The current behavior of throwing the ValueError exception and exiting
is probably what we still want in these cases.  So instead of handling
the error, the code now checks for the exception at the top-most call
and displays appropriate messages in log.error and in the ctx.summary
data itself.

Fixes: 7510
Signed-off-by: Warren Usui <warren.usui@inktank.com>
teuthology/run_tasks.py

index 84936b355afc64573369d20294ecb8552e8040d6..cc387e3795a2b0bfa8e26476db8277926c22dc33 100644 (file)
@@ -82,6 +82,15 @@ def run_tasks(tasks, ctx):
             from .task import interactive
             log.warning('Saw failure, going into interactive mode...')
             interactive.task(ctx=ctx, config=None)
+        # Throughout teuthology, (x,) = y has been used to assign values
+        # from yaml files where only one entry of type y is correct.  This
+        # causes failures with 'too many values to unpack.'  We want to
+        # fail as before, but with easier to understand error indicators.
+        if type(e) == ValueError:
+            if e.message == 'too many values to unpack':
+                emsg = 'Possible configuration error in yaml file'
+                log.error(emsg)
+                ctx.summary['failure_info'] = emsg
     finally:
         try:
             exc_info = sys.exc_info()