mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-01 21:13:09 +00:00
fixup after rebase
This commit is contained in:
@@ -12,7 +12,6 @@ use sqlx::Acquire;
|
||||
use crate::{
|
||||
config::hook::ConfigHook,
|
||||
manager::{start_stop::StartStop, Manager},
|
||||
net::keys::Key,
|
||||
};
|
||||
|
||||
use super::try_get_running_ip;
|
||||
@@ -165,26 +164,29 @@ impl OsApi for Manager {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn set_started(&self) {
|
||||
fn set_started(&self) -> Result<(), Report> {
|
||||
self.manage_container
|
||||
.current_state
|
||||
.send(StartStop::Start)
|
||||
.unwrap_or_default()
|
||||
.send_modify(|x| *x = StartStop::Start);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn restart(&self) {
|
||||
self.perform_restart().await
|
||||
async fn restart(&self) -> Result<(), Report> {
|
||||
self.perform_restart().await;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn start(&self) {
|
||||
async fn start(&self) -> Result<(), Report> {
|
||||
self.manage_container
|
||||
.wait_for_desired(StartStop::Start)
|
||||
.await
|
||||
.await;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn stop(&self) {
|
||||
async fn stop(&self) -> Result<(), Report> {
|
||||
self.manage_container
|
||||
.wait_for_desired(StartStop::Stop)
|
||||
.await
|
||||
.await;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,9 +75,9 @@ impl ManageContainer {
|
||||
}
|
||||
|
||||
pub async fn wait_for_desired(&self, new_state: StartStop) {
|
||||
let current_state = self.current_state();
|
||||
let mut current_state = self.current_state();
|
||||
self.to_desired(new_state);
|
||||
while current_state.borrow() != new_state {
|
||||
while *current_state.borrow() != new_state {
|
||||
current_state.changed().await.unwrap_or_default();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ use nix::sys::signal::Signal;
|
||||
use patch_db::DbHandle;
|
||||
use persistent_container::PersistentContainer;
|
||||
use rand::SeedableRng;
|
||||
use serde_json::Value;
|
||||
use sqlx::Connection;
|
||||
use start_stop::StartStop;
|
||||
use tokio::sync::oneshot;
|
||||
|
||||
@@ -52,7 +52,6 @@ pub async fn spawn_persistent_container(
|
||||
let mut send_inserter: Option<oneshot::Sender<Receiver<Arc<UnixRpcClient>>>> = Some(send_inserter);
|
||||
loop {
|
||||
if let Err(e) = async {
|
||||
let generated_certificate = generate_certificate(&*seed).await?;
|
||||
let (mut runtime, inserter) =
|
||||
long_running_docker(&seed, &container).await?;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ impl From<MainStatus> for StartStop {
|
||||
MainStatus::Stopped => StartStop::Stop,
|
||||
MainStatus::Restarting => StartStop::Start,
|
||||
MainStatus::Stopping => StartStop::Stop,
|
||||
MainStatus::Starting { restarting } => StartStop::Start,
|
||||
MainStatus::Starting => StartStop::Start,
|
||||
MainStatus::Running { started, health } => StartStop::Start,
|
||||
MainStatus::BackingUp { started, health } if started.is_some() => StartStop::Start,
|
||||
MainStatus::BackingUp { started, health } => StartStop::Stop,
|
||||
|
||||
Reference in New Issue
Block a user