Skip to content

Commit fe6407a

Browse files
committed
storage: Change to return Result
Prep for adding more falliable initialization here. Signed-off-by: Colin Walters <[email protected]>
1 parent 3b9cd28 commit fe6407a

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

lib/src/cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ pub(crate) async fn get_locked_sysroot() -> Result<ostree_ext::sysroot::SysrootL
433433
#[context("Initializing storage")]
434434
pub(crate) async fn get_storage() -> Result<crate::store::Storage> {
435435
let sysroot = get_locked_sysroot().await?;
436-
Ok(crate::store::Storage::new(sysroot))
436+
crate::store::Storage::new(sysroot)
437437
}
438438

439439
#[context("Querying root privilege")]

lib/src/install.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ async fn initialize_ostree_root(state: &State, root_setup: &RootSetup) -> Result
610610
let sysroot = ostree::Sysroot::new(Some(&gio::File::for_path(rootfs)));
611611
sysroot.load(cancellable)?;
612612
let sysroot = SysrootLock::new_from_sysroot(&sysroot).await?;
613-
Ok(Storage::new(sysroot))
613+
Storage::new(sysroot)
614614
}
615615

616616
#[context("Creating ostree deployment")]

lib/src/store/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl Deref for Storage {
4848
}
4949

5050
impl Storage {
51-
pub fn new(sysroot: SysrootLock) -> Self {
51+
pub fn new(sysroot: SysrootLock) -> Result<Self> {
5252
let store = match env::var("BOOTC_STORAGE") {
5353
Ok(val) => crate::spec::Store::from_str(&val, true).unwrap_or_else(|_| {
5454
let default = crate::spec::Store::default();
@@ -60,7 +60,7 @@ impl Storage {
6060

6161
let store = load(store);
6262

63-
Self { sysroot, store }
63+
Ok(Self { sysroot, store })
6464
}
6565
}
6666

0 commit comments

Comments
 (0)