hivectl: error on pause/resume of a non-existent agent
This commit is contained in:
parent
e525dcb6d4
commit
3a69ad4256
1 changed files with 12 additions and 0 deletions
|
|
@ -204,7 +204,19 @@ pub(crate) async fn agents_list(socket: &Path, json: bool) -> Result<()> {
|
||||||
/// `hivectl agent <name> pause|resume` — flip the agent's pause marker. Not a
|
/// `hivectl agent <name> pause|resume` — flip the agent's pause marker. Not a
|
||||||
/// DAG, so there's nothing to wait on: the daemon writes the marker and
|
/// DAG, so there's nothing to wait on: the daemon writes the marker and
|
||||||
/// the harness picks it up on its next poll.
|
/// the harness picks it up on its next poll.
|
||||||
|
///
|
||||||
|
/// Checks existence first, same as `agents_start` above — the daemon side
|
||||||
|
/// (`Coordinator::set_paused`) writes the marker file unconditionally via
|
||||||
|
/// the priv-helper and has no notion of "no such agent", so without this
|
||||||
|
/// check `hivectl agent typo-name resume` would exit 0 and print
|
||||||
|
/// `resumed: typo-name` for a name that was never a real agent.
|
||||||
async fn set_paused(socket: &Path, name: &str, paused: bool) -> Result<()> {
|
async fn set_paused(socket: &Path, name: &str, paused: bool) -> Result<()> {
|
||||||
|
if !crate::util::agent_exists(socket, name).await? {
|
||||||
|
bail!(
|
||||||
|
"no such agent: '{name}' (no state dir under {}/)",
|
||||||
|
hive_host_sock::AGENTS_ROOT
|
||||||
|
);
|
||||||
|
}
|
||||||
let resp = crate::client::request(
|
let resp = crate::client::request(
|
||||||
socket,
|
socket,
|
||||||
HostRequest::SetPaused {
|
HostRequest::SetPaused {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue