From 2d1f619b15203352838dd958236f8d93e15b50f2 Mon Sep 17 00:00:00 2001 From: Kyr Shatskyy Date: Thu, 30 Oct 2025 12:58:05 +0100 Subject: [PATCH] qa/cephfs: lua to respect missing kernel in yaml When teuthology-suite is called with '-k none' option, which is valid, there is no kernel record in job config created. However at some test cases the lua premerge dies with exception: KeyError: 'kernel' and when branch is not set for '-k none' and kernel client is overridden: KeyError: 'branch' so teuthology-suite quits unexpectedly without scheduling any jobs. Fixes: https://tracker.ceph.com/issues/73676 Signed-off-by: Kyr Shatskyy (cherry picked from commit b410701b7c725605a641910873b488b37fbbca59) --- qa/cephfs/begin/3-kernel.yaml | 29 +++++++++++-------- .../overrides/distro/testing/k-testing.yaml | 2 +- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/qa/cephfs/begin/3-kernel.yaml b/qa/cephfs/begin/3-kernel.yaml index e94a0d87dc8..90fe1d1c457 100644 --- a/qa/cephfs/begin/3-kernel.yaml +++ b/qa/cephfs/begin/3-kernel.yaml @@ -2,22 +2,27 @@ # all nodes (also, the kernel is "distro" when the --kernel option is not set). # We don't generally want to use a custom kernel for all tests, so unset it. # The k-testing.yaml will set it, if given, for only the client nodes. +# When the --kernel option is "none" there is no "kernel" dictionary created +# in the job base config and there is no need to unset anything. # # Allow overriding this by using a branch ending in "-all". teuthology: postmerge: - | - local branch = yaml.kernel.branch - if branch and not yaml.kernel.branch:find "-all$" then - log.debug("removing default kernel specification: %s", yaml.kernel) - py_attrgetter(yaml.kernel).pop('branch', nil) - py_attrgetter(yaml.kernel).pop('deb', nil) - py_attrgetter(yaml.kernel).pop('flavor', nil) - py_attrgetter(yaml.kernel).pop('kdb', nil) - py_attrgetter(yaml.kernel).pop('koji', nil) - py_attrgetter(yaml.kernel).pop('koji_task', nil) - py_attrgetter(yaml.kernel).pop('rpm', nil) - py_attrgetter(yaml.kernel).pop('sha1', nil) - py_attrgetter(yaml.kernel).pop('tag', nil) + local kernel = py_attrgetter(yaml).get('kernel') + if kernel ~= nil then + local branch = py_attrgetter(kernel).get('branch') + if branch and not kernel.branch:find "-all$" then + log.debug("removing default kernel specification: %s", kernel) + py_attrgetter(kernel).pop('branch', nil) + py_attrgetter(kernel).pop('deb', nil) + py_attrgetter(kernel).pop('flavor', nil) + py_attrgetter(kernel).pop('kdb', nil) + py_attrgetter(kernel).pop('koji', nil) + py_attrgetter(kernel).pop('koji_task', nil) + py_attrgetter(kernel).pop('rpm', nil) + py_attrgetter(kernel).pop('sha1', nil) + py_attrgetter(kernel).pop('tag', nil) + end end diff --git a/qa/cephfs/mount/kclient/overrides/distro/testing/k-testing.yaml b/qa/cephfs/mount/kclient/overrides/distro/testing/k-testing.yaml index f8546a1491a..8467bb2c4be 100644 --- a/qa/cephfs/mount/kclient/overrides/distro/testing/k-testing.yaml +++ b/qa/cephfs/mount/kclient/overrides/distro/testing/k-testing.yaml @@ -2,7 +2,7 @@ teuthology: premerge: | log.debug("base kernel %s", base_config.kernel) local kernel = base_config.kernel - if kernel.branch ~= "distro" then + if kernel ~= nil and kernel.branch ~= "distro" then log.debug("overriding testing kernel with %s", kernel) yaml_fragment.kernel.client = kernel end -- 2.47.3