get_logs: resolve machine name via container_name like every other verb
This commit is contained in:
parent
7ce3da1e21
commit
0a79912b67
4 changed files with 27 additions and 9 deletions
|
|
@ -286,11 +286,16 @@ async fn dispatch(req: &ManagerRequest, coord: &Arc<Coordinator>) -> ManagerResp
|
|||
}
|
||||
ManagerRequest::GetLogs { agent, lines } => {
|
||||
let n = lines.unwrap_or(50);
|
||||
tracing::info!(%agent, %n, "manager: get_logs");
|
||||
// `journalctl -M` wants the *machine* name, not the
|
||||
// logical agent name. Map it the same way every other
|
||||
// lifecycle verb does so the caller passes `gui` and we
|
||||
// resolve `h-gui` (manager stays `hm1nd`).
|
||||
let machine = crate::lifecycle::container_name(agent);
|
||||
tracing::info!(%agent, %machine, %n, "manager: get_logs");
|
||||
match tokio::process::Command::new("journalctl")
|
||||
.args([
|
||||
"-M",
|
||||
agent,
|
||||
&machine,
|
||||
"-n",
|
||||
&n.to_string(),
|
||||
"--no-pager",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue