get_logs: resolve the broker-logical 'manager' alias to the hm1nd machine
This commit is contained in:
parent
0a79912b67
commit
24b10becc9
1 changed files with 11 additions and 4 deletions
|
|
@ -287,10 +287,17 @@ async fn dispatch(req: &ManagerRequest, coord: &Arc<Coordinator>) -> ManagerResp
|
||||||
ManagerRequest::GetLogs { agent, lines } => {
|
ManagerRequest::GetLogs { agent, lines } => {
|
||||||
let n = lines.unwrap_or(50);
|
let n = lines.unwrap_or(50);
|
||||||
// `journalctl -M` wants the *machine* name, not the
|
// `journalctl -M` wants the *machine* name, not the
|
||||||
// logical agent name. Map it the same way every other
|
// logical agent name: `gui` → `h-gui`. `container_name`
|
||||||
// lifecycle verb does so the caller passes `gui` and we
|
// does that and passes `hm1nd` through unprefixed — but
|
||||||
// resolve `h-gui` (manager stays `hm1nd`).
|
// it doesn't know the broker-logical manager name
|
||||||
let machine = crate::lifecycle::container_name(agent);
|
// `"manager"` (it'd wrongly produce `h-manager`), so
|
||||||
|
// handle that alias explicitly. Either manager spelling
|
||||||
|
// resolves to the unprefixed `hm1nd` machine.
|
||||||
|
let machine = if agent == MANAGER_AGENT {
|
||||||
|
crate::lifecycle::MANAGER_NAME.to_owned()
|
||||||
|
} else {
|
||||||
|
crate::lifecycle::container_name(agent)
|
||||||
|
};
|
||||||
tracing::info!(%agent, %machine, %n, "manager: get_logs");
|
tracing::info!(%agent, %machine, %n, "manager: get_logs");
|
||||||
match tokio::process::Command::new("journalctl")
|
match tokio::process::Command::new("journalctl")
|
||||||
.args([
|
.args([
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue