refactor(#1474): group journalctl read args into a journalquery struct
This commit is contained in:
parent
98660d134a
commit
f751c4495f
7 changed files with 77 additions and 116 deletions
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
use anyhow::{Context as _, Result, bail};
|
||||
use hive_sh4re::priv_proto::{
|
||||
BindMount, JournalOutput, NetworkIsolation, PRIV_SOCK, PrivEvent, PrivRequest, PrivResponse,
|
||||
BindMount, JournalQuery, NetworkIsolation, PRIV_SOCK, PrivEvent, PrivRequest, PrivResponse,
|
||||
PrivStream,
|
||||
};
|
||||
use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader};
|
||||
|
|
@ -162,29 +162,14 @@ pub async fn list_containers() -> Result<String> {
|
|||
/// Read a container's journal via the root helper (`journalctl -M`).
|
||||
/// Returns `(stdout, stderr)`; a non-zero journalctl exit is reported in
|
||||
/// `stderr` rather than as an `Err`, so callers can surface either.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub async fn read_container_journal(
|
||||
container: &str,
|
||||
lines: u32,
|
||||
boot: bool,
|
||||
output: JournalOutput,
|
||||
unit: Option<String>,
|
||||
priority: Option<String>,
|
||||
grep: Option<String>,
|
||||
since: Option<String>,
|
||||
until: Option<String>,
|
||||
query: JournalQuery,
|
||||
) -> Result<(String, String)> {
|
||||
check(
|
||||
call(&PrivRequest::ReadContainerJournal {
|
||||
container: container.to_owned(),
|
||||
lines,
|
||||
boot,
|
||||
output,
|
||||
unit,
|
||||
priority,
|
||||
grep,
|
||||
since,
|
||||
until,
|
||||
query,
|
||||
})
|
||||
.await?,
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue