]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
suite: do not calculate product on an empty list
authorSage Weil <sage@inktank.com>
Fri, 13 Sep 2013 15:22:12 +0000 (08:22 -0700)
committerSage Weil <sage@inktank.com>
Fri, 13 Sep 2013 15:22:12 +0000 (08:22 -0700)
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>
teuthology/suite.py

index 0f79519dd132ed89163e725ceb1f01e451614dbf..e1ccc53c360fcb9ad097b5dc0e078736fc070aed 100644 (file)
@@ -246,12 +246,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