Skip to content

Commit

Permalink
Journctl tool: Add sudo param in first_n_logs_from_boot
Browse files Browse the repository at this point in the history
  • Loading branch information
adityagesh authored and LiliDeng committed Aug 9, 2023
1 parent b1dabaa commit 573570b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lisa/tools/journalctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ def logs_for_unit(self, unit_name: str, sudo: bool = True) -> str:

return result.stdout

def first_n_logs_from_boot(self, boot_id: str = "", no_of_lines: int = 1000) -> str:
def first_n_logs_from_boot(
self, boot_id: str = "", no_of_lines: int = 1000, sudo: bool = True
) -> str:
result = self.run(
f"-b {boot_id} | head -n {no_of_lines} ",
force_run=True,
shell=True,
sudo=True,
sudo=sudo,
expected_exit_code=0,
)
return result.stdout

0 comments on commit 573570b

Please sign in to comment.