Bugfix/boot cleanup (#1023)

* do not expect the node to exist on cleanup

* fix reference

* fix types
This commit is contained in:
Lucy C
2022-01-04 11:37:31 -07:00
committed by Aiden McClelland
parent 4e431a2ed7
commit 547d1a0856

View File

@@ -7,6 +7,7 @@ use std::sync::Arc;
use std::time::Duration;
use bollard::Docker;
use color_eyre::eyre::eyre;
use patch_db::json_ptr::JsonPointer;
use patch_db::{DbHandle, PatchDb, Revision};
use reqwest::Url;
@@ -306,11 +307,14 @@ impl RpcContext {
let mut pde = crate::db::DatabaseModel::new()
.package_data()
.idx_model(&package_id)
.expect(&mut db)
.await?
.get_mut(&mut db)
.await?;
match &mut *pde {
match pde.as_mut().ok_or_else(|| {
Error::new(
eyre!("Node does not exist: /package-data/{}", package_id),
crate::ErrorKind::Database,
)
})? {
PackageDataEntry::Installing { .. }
| PackageDataEntry::Restoring { .. }
| PackageDataEntry::Updating { .. } => {