Skip to content

Commit

Permalink
expose reboot over API
Browse files Browse the repository at this point in the history
  • Loading branch information
svenrademakers committed Nov 3, 2023
1 parent 30fcf7c commit 5f8ed0f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/api/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ async fn api_entry(bmc: web::Data<BmcApplication>, query: Query) -> impl Respond
("other", false) => get_system_information().await.into(),
("power", true) => set_node_power(bmc, query).await,
("power", false) => get_node_power(bmc).await.into(),
("reboot", false) => reboot().await.into(),
("reset", true) => reset_node(bmc, query).await.into(),
("sdcard", true) => format_sdcard().into(),
("sdcard", false) => get_sdcard_info(),
Expand All @@ -119,6 +120,10 @@ async fn api_entry(bmc: web::Data<BmcApplication>, query: Query) -> impl Respond
}
}

async fn reboot() -> LegacyResult<()> {
BmcApplication::reboot().await.map_err(Into::into)
}

async fn reset_node(bmc: &BmcApplication, query: Query) -> LegacyResult<()> {
let node = get_node_param(&query)?;
Ok(bmc.reset_node(node).await?)
Expand Down

0 comments on commit 5f8ed0f

Please sign in to comment.