set_status: consolidate whoami into get_agent_meta with optional name
This commit is contained in:
parent
77fdaf0d1e
commit
73871f18c3
10 changed files with 114 additions and 200 deletions
|
|
@ -480,17 +480,6 @@ async fn dispatch(req: &ManagerRequest, coord: &Arc<Coordinator>) -> ManagerResp
|
|||
},
|
||||
}
|
||||
}
|
||||
ManagerRequest::Whoami => {
|
||||
let (status_text, status_set_at) =
|
||||
crate::container_view::read_agent_status(MANAGER_AGENT);
|
||||
ManagerResponse::Whoami {
|
||||
name: MANAGER_AGENT.to_owned(),
|
||||
role: "manager".to_owned(),
|
||||
hyperhive_rev: crate::auto_update::current_flake_rev(&coord.hyperhive_flake),
|
||||
status_text,
|
||||
status_set_at,
|
||||
}
|
||||
}
|
||||
ManagerRequest::SetStatus { text } => {
|
||||
let path = Coordinator::agent_notes_dir(MANAGER_AGENT).join("hyperhive-status");
|
||||
let result = if text.trim().is_empty() {
|
||||
|
|
@ -513,10 +502,14 @@ async fn dispatch(req: &ManagerRequest, coord: &Arc<Coordinator>) -> ManagerResp
|
|||
}
|
||||
}
|
||||
ManagerRequest::GetAgentMeta { name } => {
|
||||
let target = name.as_deref().unwrap_or(MANAGER_AGENT);
|
||||
let (status_text, status_set_at) =
|
||||
crate::container_view::read_agent_status(name);
|
||||
crate::container_view::read_agent_status(target);
|
||||
let role = if target == MANAGER_AGENT { "manager" } else { "agent" }.to_owned();
|
||||
ManagerResponse::AgentMeta {
|
||||
name: name.clone(),
|
||||
name: target.to_owned(),
|
||||
role,
|
||||
hyperhive_rev: crate::auto_update::current_flake_rev(&coord.hyperhive_flake),
|
||||
status_text,
|
||||
status_set_at,
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue