feat(kernel): Canonical Livepatch's status as root, for the kernel facts (NetOrk/netork#2701)
Where the status does not read without root, the kernel facts read it again through the driver's sudo: one fixed, read-only command.
This commit is contained in:
1 parent
e0c083e0c0
commit
f6fed234cd
2 files changed
+21
-1
No files matched your search
@@ -2838,3 +2838,17 @@ class TestSourceRpmName:
|
||||
)
|
||||
def test_the_name_is_what_precedes_version_and_release(self, sourcerpm, name):
|
||||
assert source_rpm_name(sourcerpm) == name
|
||||
|
||||
|
||||
class TestCanonicalLivepatchAsRoot:
|
||||
"""The kernel facts read Canonical Livepatch's status (NetOrk/netork#2701); where it did
|
||||
not read without root, the driver reads it again through its sudo."""
|
||||
|
||||
def test_the_status_command_runs_as_root(self, driver):
|
||||
from napalm_device_types import LIVEPATCH_STATUS_COMMAND
|
||||
|
||||
calls = []
|
||||
driver._run_privileged = lambda command, timeout=100: calls.append(command) or "{}"
|
||||
|
||||
assert driver._run_livepatch_status_command(LIVEPATCH_STATUS_COMMAND) == "{}"
|
||||
assert calls == [LIVEPATCH_STATUS_COMMAND]
|
||||
Reference in new issue
Block a user