Feat/implement rest of poly effects (#2587)

* feat: Add the implementation of the rest of the polyfillEffects

* chore: Add in the rsync

* chore: Add in the changes needed to indicate that the service does not need config

* fix: Vaultwarden sets, starts, stops, uninstalls

* chore: Update the polyFilleffect and add two more

* Update MainLoop.ts

* chore: Add in the set config of the deps on the config set
This commit is contained in:
Jade
2024-04-04 09:09:59 -06:00
committed by GitHub
parent 3b9298ed2b
commit 6bc8027644
8 changed files with 272 additions and 81 deletions

View File

@@ -3,7 +3,7 @@ use std::time::Duration;
use models::ProcedureName;
use crate::config::action::ConfigRes;
use crate::config::ConfigureContext;
use crate::config::{action::SetResult, ConfigureContext};
use crate::prelude::*;
use crate::service::{Service, ServiceActor};
use crate::util::actor::{BackgroundJobs, Handler};
@@ -18,10 +18,25 @@ impl Handler<Configure> for ServiceActor {
_: &mut BackgroundJobs,
) -> Self::Response {
let container = &self.0.persistent_container;
let package_id = &self.0.id;
container
.execute::<NoOutput>(ProcedureName::SetConfig, to_value(&config)?, timeout)
.await
.with_kind(ErrorKind::ConfigRulesViolation)?;
self.0
.ctx
.db
.mutate(move |db| {
db.as_public_mut()
.as_package_data_mut()
.as_idx_mut(package_id)
.or_not_found(package_id)?
.as_status_mut()
.as_configured_mut()
.ser(&true)
})
.await?;
Ok(())
}
}
@@ -38,7 +53,7 @@ impl Handler<GetConfig> for ServiceActor {
Some(Duration::from_secs(30)), // TODO timeout
)
.await
.with_kind(ErrorKind::ConfigGen)
.with_kind(ErrorKind::ConfigRulesViolation)
}
}

View File

@@ -281,6 +281,9 @@ impl Service {
.as_package_data_mut()
.as_idx_mut(&manifest.id)
.or_not_found(&manifest.id)?;
if !manifest.has_config {
entry.as_status_mut().as_configured_mut().ser(&true)?;
}
entry
.as_state_info_mut()
.ser(&PackageState::Installed(InstalledState { manifest }))?;