🐛 Fix detecting running kernel on Debian buster
This commit is contained in:
parent
427e953b7a
commit
85dabb0846
2 changed files with 5 additions and 1 deletions
|
@ -70,7 +70,7 @@ def running_kernel_version():
|
||||||
|
|
||||||
if re.search('Debian', proc_version_):
|
if re.search('Debian', proc_version_):
|
||||||
# Remove gcc version first
|
# Remove gcc version first
|
||||||
proc_version_ = re.sub('\(gcc[^(]+\(Debian [^)]+\)\s+\)', '',
|
proc_version_ = re.sub('\(gcc[^(]+\(Debian [^)]+\)\s*\)', '',
|
||||||
proc_version_)
|
proc_version_)
|
||||||
|
|
||||||
# Then look for the Debian kernel version
|
# Then look for the Debian kernel version
|
||||||
|
|
|
@ -45,6 +45,10 @@ class RunningKernelVersionTestCase(unittest.TestCase):
|
||||||
Version('4.0.3-301'))
|
Version('4.0.3-301'))
|
||||||
|
|
||||||
def testDebian(self):
|
def testDebian(self):
|
||||||
|
patch_object(check_kernel, 'proc_version', return_value='Linux version 4.19.0-5-amd64 (debian-kernel@lists.debian.org) (gcc version 8.3.0 (Debian 8.3.0-7)) #1 SMP Debian 4.19.37-5 (2019-06-19)')
|
||||||
|
self.assertEqual(check_kernel.running_kernel_version(),
|
||||||
|
Version('4.19.37-5'))
|
||||||
|
|
||||||
patch_object(check_kernel, 'proc_version', return_value='Linux version 3.16.0-4-amd64 (debian-kernel@lists.debian.org) (gcc version 4.8.4 (Debian 4.8.4-1) ) #1 SMP Debian 3.16.7-ckt9-3~deb8u1 (2015-04-24)')
|
patch_object(check_kernel, 'proc_version', return_value='Linux version 3.16.0-4-amd64 (debian-kernel@lists.debian.org) (gcc version 4.8.4 (Debian 4.8.4-1) ) #1 SMP Debian 3.16.7-ckt9-3~deb8u1 (2015-04-24)')
|
||||||
self.assertEqual(check_kernel.running_kernel_version(),
|
self.assertEqual(check_kernel.running_kernel_version(),
|
||||||
Version('3.16.7-ckt9-3~deb8u1'))
|
Version('3.16.7-ckt9-3~deb8u1'))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue