Skip to content

Commit 4c13694

Browse files
Modify Linux kernel version check to require at least version 4.6 (#35)
Modify Linux kernel version check to require kernel version 4.6 or higher
1 parent 758b9bd commit 4c13694

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
The v1 release supports Cisco IOS-XR release versions from 7.7.1 to 7.9.1.
77

8+
### v1.1.13 (2023-10-11)
9+
10+
- Modify Linux kernel version check to require kernel version 4.6 or higher.
11+
812
### v1.1.12 (2023-06-30)
913

1014
- Add Docker Compose v2 support to `host-check` and `xr-compose` scripts.

scripts/host-check

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,13 +413,13 @@ def check_kernel_version() -> CheckFuncReturn:
413413
except Exception:
414414
return (
415415
CheckState.ERROR,
416-
f"Unable to check the kernel version with command {cmd!r} - must be at least version 4.0",
416+
f"Unable to check the kernel version with command {cmd!r} - must be at least version 4.6",
417417
)
418418

419-
if version_tuple < (4, 0):
419+
if version_tuple < (4, 6):
420420
return (
421421
CheckState.FAILED,
422-
f"The kernel version is {version}, but at least version 4.0 is required.",
422+
f"The kernel version is {version}, but at least version 4.6 is required.",
423423
)
424424

425425
# Check for RHEL/CentOS 8.3 kernel version

tests/test_host_check.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -970,8 +970,8 @@ class TestKernelVersion(_CheckTestBase):
970970

971971
def test_success(self, capsys):
972972
"""Test the success case."""
973-
result, output = self.perform_check(capsys, cmd_effects="4.1")
974-
assert textwrap.dedent(output) == "PASS -- Kernel version (4.1)\n"
973+
result, output = self.perform_check(capsys, cmd_effects="4.6")
974+
assert textwrap.dedent(output) == "PASS -- Kernel version (4.6)\n"
975975
assert result is CheckState.SUCCESS
976976

977977
def test_subproc_error(self, capsys):
@@ -982,7 +982,7 @@ def test_subproc_error(self, capsys):
982982
assert textwrap.dedent(output) == textwrap.dedent(
983983
"""\
984984
ERROR -- Kernel version
985-
Unable to check the kernel version with command 'uname -r' - must be at least version 4.0
985+
Unable to check the kernel version with command 'uname -r' - must be at least version 4.6
986986
"""
987987
)
988988
assert result is CheckState.ERROR
@@ -995,18 +995,29 @@ def test_no_version_match(self, capsys):
995995
assert textwrap.dedent(output) == textwrap.dedent(
996996
"""\
997997
ERROR -- Kernel version
998-
Unable to check the kernel version with command 'uname -r' - must be at least version 4.0
998+
Unable to check the kernel version with command 'uname -r' - must be at least version 4.6
999999
"""
10001000
)
10011001
assert result is CheckState.ERROR
10021002

1003-
def test_old_version(self, capsys):
1003+
def test_old_major_version(self, capsys):
10041004
"""Test the version being too old."""
10051005
result, output = self.perform_check(capsys, cmd_effects="3.9.8")
10061006
assert textwrap.dedent(output) == textwrap.dedent(
10071007
"""\
10081008
FAIL -- Kernel version
1009-
The kernel version is 3.9, but at least version 4.0 is required.
1009+
The kernel version is 3.9, but at least version 4.6 is required.
1010+
"""
1011+
)
1012+
assert result is CheckState.FAILED
1013+
1014+
def test_old_minor_version(self, capsys):
1015+
"""Test the version being too old."""
1016+
result, output = self.perform_check(capsys, cmd_effects="4.5")
1017+
assert textwrap.dedent(output) == textwrap.dedent(
1018+
"""\
1019+
FAIL -- Kernel version
1020+
The kernel version is 4.5, but at least version 4.6 is required.
10101021
"""
10111022
)
10121023
assert result is CheckState.FAILED

0 commit comments

Comments
 (0)