mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
completion bool fixes
This commit is contained in:
committed by
Aiden McClelland
parent
6e82ef48ca
commit
269ee0cf01
@@ -1,8 +1,10 @@
|
||||
use std::borrow::Cow;
|
||||
|
||||
use anyhow::anyhow;
|
||||
use bollard::Docker;
|
||||
use patch_db::DbHandle;
|
||||
|
||||
use crate::context::RpcContext;
|
||||
use crate::db::model::InstalledPackageDataEntry;
|
||||
use crate::dependencies::DependencyError;
|
||||
use crate::s9pk::manifest::{Manifest, PackageId};
|
||||
@@ -59,15 +61,21 @@ pub async fn update_dependents<'a, Db: DbHandle, I: IntoIterator<Item = &'a Pack
|
||||
}
|
||||
|
||||
pub async fn cleanup<Db: DbHandle>(
|
||||
ctx: &RpcContext,
|
||||
db: &mut Db,
|
||||
info: Result<InstalledPackageDataEntry, &Manifest>,
|
||||
) -> Result<(), Error> {
|
||||
let man = match info {
|
||||
Ok(pde) => {
|
||||
todo!();
|
||||
// TODO
|
||||
|
||||
Cow::Owned(pde.manifest)
|
||||
}
|
||||
Err(man) => Cow::Borrowed(man),
|
||||
};
|
||||
ctx.managers
|
||||
.remove(&(man.id.clone(), man.version.clone()))
|
||||
.await;
|
||||
// docker images start9/$APP_ID/*:$VERSION -q | xargs docker rmi
|
||||
Ok(()) // TODO
|
||||
}
|
||||
|
||||
@@ -185,6 +185,8 @@ pub async fn download_install_s9pk(
|
||||
.await;
|
||||
|
||||
let mut s9pk_reader = if let Some(cached) = cached {
|
||||
progress.download_complete();
|
||||
progress_model.put(&mut ctx.db.handle(), &progress).await?;
|
||||
cached
|
||||
} else {
|
||||
File::delete(&pkg_cache).await?;
|
||||
@@ -238,7 +240,7 @@ pub async fn download_install_s9pk(
|
||||
|
||||
if let Err(e) = res {
|
||||
let mut handle = ctx.db.handle();
|
||||
if let Err(e) = cleanup(&mut handle, Err(temp_manifest)).await {
|
||||
if let Err(e) = cleanup(&ctx, &mut handle, Err(temp_manifest)).await {
|
||||
log::error!(
|
||||
"Failed to clean up {}@{}: {}: Adding to broken packages",
|
||||
pkg_id,
|
||||
@@ -561,7 +563,7 @@ pub async fn install_s9pk<R: AsyncRead + AsyncSeek + Unpin>(
|
||||
{
|
||||
configured &= res.configured;
|
||||
}
|
||||
cleanup(&mut tx, Ok(prev)).await?;
|
||||
cleanup(&ctx, &mut tx, Ok(prev)).await?;
|
||||
if let Some(res) = manifest
|
||||
.migrations
|
||||
.from(&prev_manifest.version, pkg_id, version, &manifest.volumes)
|
||||
|
||||
@@ -122,6 +122,9 @@ impl<RW> InstallProgressTracker<RW> {
|
||||
}
|
||||
pub fn validated(&mut self) {
|
||||
self.validating = false;
|
||||
self.progress
|
||||
.validation_complete
|
||||
.store(true, Ordering::SeqCst);
|
||||
}
|
||||
}
|
||||
impl<W: AsyncWrite> AsyncWrite for InstallProgressTracker<W> {
|
||||
|
||||
Reference in New Issue
Block a user