From df50197c5fb03ad8309cee51611f7013ec4c4a70 Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Tue, 14 Sep 2021 11:44:23 -0600 Subject: [PATCH] fix build --- appmgr/src/bin/embassy-init.rs | 2 +- appmgr/src/context/recovery.rs | 5 ++++- appmgr/src/recovery.rs | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/appmgr/src/bin/embassy-init.rs b/appmgr/src/bin/embassy-init.rs index b7efdfa6c..eb2140ecb 100644 --- a/appmgr/src/bin/embassy-init.rs +++ b/appmgr/src/bin/embassy-init.rs @@ -139,7 +139,7 @@ async fn inner_main(cfg_path: Option<&str>) -> Result<(), Error> { log::error!("{}", e.source); log::debug!("{}", e.source); embassy::sound::BEETHOVEN.play().await?; - let ctx = RecoveryContext::init(cfg_path).await?; + let ctx = RecoveryContext::init(cfg_path, e).await?; rpc_server!({ command: embassy::recovery_api, context: ctx.clone(), diff --git a/appmgr/src/context/recovery.rs b/appmgr/src/context/recovery.rs index 1731e5bb1..ee6c228d0 100644 --- a/appmgr/src/context/recovery.rs +++ b/appmgr/src/context/recovery.rs @@ -3,6 +3,7 @@ use std::ops::Deref; use std::path::Path; use std::sync::Arc; +use rpc_toolkit::yajrc::RpcError; use rpc_toolkit::Context; use serde::Deserialize; use tokio::fs::File; @@ -37,12 +38,13 @@ impl RecoveryContextConfig { pub struct RecoveryContextSeed { pub bind_rpc: SocketAddr, pub shutdown: Sender<()>, + pub error: Arc, } #[derive(Clone)] pub struct RecoveryContext(Arc); impl RecoveryContext { - pub async fn init>(path: Option

) -> Result { + pub async fn init>(path: Option

, error: Error) -> Result { let cfg = RecoveryContextConfig::load(path).await?; let (shutdown, _) = tokio::sync::broadcast::channel(1); @@ -50,6 +52,7 @@ impl RecoveryContext { Ok(Self(Arc::new(RecoveryContextSeed { bind_rpc: cfg.bind_rpc.unwrap_or(([127, 0, 0, 1], 5959).into()), shutdown, + error: Arc::new(error.into()), }))) } } diff --git a/appmgr/src/recovery.rs b/appmgr/src/recovery.rs index 2bf5568c2..ddd1978e0 100644 --- a/appmgr/src/recovery.rs +++ b/appmgr/src/recovery.rs @@ -5,6 +5,7 @@ use rpc_toolkit::yajrc::RpcError; use crate::context::RecoveryContext; use crate::logs::{display_logs, fetch_logs, LogResponse, LogSource}; +use crate::util::display_none; use crate::Error; pub const SYSTEMD_UNIT: &'static str = "embassy-init"; @@ -34,7 +35,8 @@ pub async fn logs( .await?) } -#[command] +#[command(display(display_none))] pub fn exit(#[context] ctx: RecoveryContext) -> Result<(), Error> { ctx.shutdown.send(()).expect("receiver dropped"); + Ok(()) }