From: Sage Weil Date: Tue, 17 Sep 2013 03:22:09 +0000 (-0700) Subject: suite: do not calculate product on an empty list (take 2) X-Git-Tag: 1.1.0~1872 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4520c5f6f5e2de12ee673d97870e6b2fc9992e60;p=teuthology.git suite: do not calculate product on an empty list (take 2) The original attempt to fix this with dda7954090ccc9ffd8ecd961d6b530a0e6d24964 failed because I screwed up the indentation for the out.append(...) line. Signed-off-by: Sage Weil --- diff --git a/teuthology/suite.py b/teuthology/suite.py index 0fc079a49..89910b1df 100644 --- a/teuthology/suite.py +++ b/teuthology/suite.py @@ -250,12 +250,13 @@ def build_matrix(path): raw = build_matrix(os.path.join(path, fn)) sublists.append([(combine_path(fn, item[0]), item[1]) for item in raw]) out = [] - for sublist in itertools.product(*sublists): - name = '{' + ' '.join([item[0] for item in sublist]) + '}' - val = [] - for item in sublist: - val.extend(item[1]) - out.append((name, val)) + if sublists: + for sublist in itertools.product(*sublists): + name = '{' + ' '.join([item[0] for item in sublist]) + '}' + val = [] + for item in sublist: + val.extend(item[1]) + out.append((name, val)) return out else: # list items