This fixes a bug where a directory with just % generates a
bogus job item with no actual content. (e.g.,
$ find basic
basic
basic/%
$ teuthology-suite --dry-run --base . --collections basic --name foo
INFO:teuthology.suite:Collection basic in ./basic
INFO:teuthology.suite:configs [('basic/{}', [])]
...which then blows up because the job yaml is empty. With
the fix, there are no generated jobs:
$ teuthology-suite --dry-run --base . --collections basic --name foo
INFO:teuthology.suite:Collection basic in ./basic
INFO:teuthology.suite:configs []
(The configs print was temporarily added for debugging
purposes.)
Signed-off-by: Sage Weil <sage@inktank.com>
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