]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
teuthology/suite: extract match() for filtering jobs 1450/head
authorKefu Chai <kchai@redhat.com>
Fri, 17 Apr 2020 04:02:14 +0000 (12:02 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 17 Apr 2020 04:25:04 +0000 (12:25 +0800)
for better readablity

Signed-off-by: Kefu Chai <kchai@redhat.com>
teuthology/suite/run.py

index 7b217352336f46aebfb7b8e753e1907325e83b4a..2a421d5f1e608fec4c580291d2ec8b0ab3af1d21 100644 (file)
@@ -373,24 +373,19 @@ class Run(object):
                 break
             # Break apart the filter parameter (one string) into comma
             # separated components to be used in searches.
+            def matches(f):
+                if f in description:
+                    return True
+                if any(f in path for path in base_frag_paths):
+                    return True
+                return False
             filter_in = self.args.filter_in
             if filter_in:
-                if not any([x in description for x in filter_in]):
-                    for filt_samp in filter_in:
-                        if any(x.find(filt_samp) >= 0 for x in base_frag_paths):
-                            break
-                    else:
-                        continue
+                if not any(matches(f) for f in filter_in):
+                    continue
             filter_out = self.args.filter_out
             if filter_out:
-                if any([x in description for x in filter_out]):
-                    continue
-                is_collected = True
-                for filt_samp in filter_out:
-                    if any(filt_samp in x for x in base_frag_paths):
-                        is_collected = False
-                        break
-                if not is_collected:
+                if any(matches(f) for f in filter_out):
                     continue
 
             raw_yaml = '\n'.join([open(a, 'r').read() for a in fragment_paths])