Skip to content

Commit 75fa2e0

Browse files
committed
ostree-ext: Replace config loading with a stub if we detect mock
Workaround for rpm-software-management/mock#1613 (comment) Signed-off-by: Colin Walters <[email protected]>
1 parent 8abee04 commit 75fa2e0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

crates/ostree-ext/src/globals.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,17 @@ impl ConfigPaths {
8181

8282
/// Return the path to the global container authentication file, if it exists.
8383
pub fn get_global_authfile(root: &Dir) -> Result<Option<(Utf8PathBuf, File)>> {
84-
let root = &RootDir::new(root, ".")?;
84+
// Workaround for https://github.com/rpm-software-management/mock/pull/1613#issuecomment-3421908652
85+
#[cfg(test)]
86+
if matches!(
87+
std::env::var("container").ok().as_deref(),
88+
Some("systemd-nspawn")
89+
) {
90+
return Ok(None);
91+
}
92+
8593
let am_uid0 = rustix::process::getuid() == rustix::process::Uid::ROOT;
94+
let root = &RootDir::new(root, ".")?;
8695
get_global_authfile_impl(root, am_uid0)
8796
}
8897

0 commit comments

Comments
 (0)