]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
task.kernel: Make task() a context manager
authorZack Cerza <zack@redhat.com>
Fri, 17 Mar 2023 01:20:22 +0000 (19:20 -0600)
committerZack Cerza <zack@redhat.com>
Wed, 22 Mar 2023 15:52:10 +0000 (09:52 -0600)
This will cause it to be instrumented for timing via the bits in
run_tasks.

Signed-off-by: Zack Cerza <zack@redhat.com>
teuthology/task/kernel.py

index 8879963cafe0bd7bc27019f84c4ce3c82ba416df..c0c2a1f5537f90b6a3f70425a94b77001a42abd8 100644 (file)
@@ -2,6 +2,7 @@
 Kernel installation task
 """
 
+import contextlib
 import logging
 import os
 import re
@@ -1130,6 +1131,7 @@ def get_sha1_from_pkg_name(path):
     return sha1
 
 
+@contextlib.contextmanager
 def task(ctx, config):
     """
     Make sure the specified kernel is installed.
@@ -1234,6 +1236,11 @@ def task(ctx, config):
         for role, role_config in config.items():
             p.spawn(process_role, ctx, config, timeout, role, role_config)
 
+    try:
+        yield
+    finally:
+        pass
+
 
 def process_role(ctx, config, timeout, role, role_config):
     need_install = None  # sha1 to dl, or path to rpm or deb