From 3c9e82e4da55202575dba42eee57203962011407 Mon Sep 17 00:00:00 2001 From: Dan Mick Date: Tue, 16 May 2023 17:05:15 -0700 Subject: [PATCH] task/kernel.py: sort installed kernels by version rpm -q --last sorts by timestamp-of-install, which does not necessarily correlate with "latest version". sort -rV does. Signed-off-by: Dan Mick --- teuthology/task/kernel.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/teuthology/task/kernel.py b/teuthology/task/kernel.py index c0c2a1f553..70d49059c6 100644 --- a/teuthology/task/kernel.py +++ b/teuthology/task/kernel.py @@ -1053,9 +1053,9 @@ def get_latest_image_version_rpm(remote): kernel_pkg_name = "kernel-default" else: kernel_pkg_name = "kernel" - # get tip of package list ordered by install time + # get tip of package list ordered by descending version newest_package = remote.sh( - 'rpm -q %s --last | head -n 1' % kernel_pkg_name).strip() + 'rpm -q %s | sort -rV | head -n 1' % kernel_pkg_name).strip() for kernel in newest_package.split(): if kernel.startswith('kernel'): if 'ceph' not in kernel: -- 2.39.5