From edbc3d9dff57ef99e91bd5e9f3203bc8be209a02 Mon Sep 17 00:00:00 2001 From: Ricardo Marques Date: Fri, 5 Jan 2018 12:07:35 +0000 Subject: [PATCH] rbd-target-api: fix kernel release parser Signed-off-by: Ricardo Marques --- rbd-target-api.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rbd-target-api.py b/rbd-target-api.py index b6cc8b6..ce34c6f 100755 --- a/rbd-target-api.py +++ b/rbd-target-api.py @@ -1495,7 +1495,9 @@ def pre_reqs_errors(): os_info = os.uname() this_arch = os_info[-1] this_kernel = os_info[2].replace(".{}".format(this_arch), '') - this_ver, this_rel = this_kernel.split('-') + kernel_dash_idx = this_kernel.find('-') + this_ver = this_kernel[:kernel_dash_idx] + this_rel = this_kernel[kernel_dash_idx+1:] # use labelCompare from the rpm module to handle the comparison if labelCompare(('1', this_ver, this_rel), ('1', k_vers, k_rel)) < 0: