From 4520c5f6f5e2de12ee673d97870e6b2fc9992e60 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 16 Sep 2013 20:22:09 -0700 Subject: [PATCH] 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 --- teuthology/suite.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/teuthology/suite.py b/teuthology/suite.py index 0fc079a495f5d..89910b1dfe6e7 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 -- 2.39.5