Skip to content

Commit e0bae1f

Browse files
committed
install: Drop skopeo-in-host fallback code
Now that we unconditionally mount /var/lib/containers, drop the hacky fork-skopeo-in-host-mountns code. Signed-off-by: Colin Walters <[email protected]>
1 parent f81ae83 commit e0bae1f

File tree

1 file changed

+3
-70
lines changed

1 file changed

+3
-70
lines changed

lib/src/install.rs

Lines changed: 3 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,6 @@ pub(crate) struct SourceInfo {
333333
pub(crate) selinux: bool,
334334
/// Whether the source is available in the host mount namespace
335335
pub(crate) in_host_mountns: bool,
336-
/// Whether we were invoked with -v /var/lib/containers:/var/lib/containers
337-
pub(crate) have_host_container_storage: bool,
338336
}
339337

340338
// Shared read-only global state
@@ -516,38 +514,13 @@ impl SourceInfo {
516514
tracing::debug!("Finding digest for image ID {}", container_info.imageid);
517515
let digest = crate::podman::imageid_to_digest(&container_info.imageid)?;
518516

519-
let have_host_container_storage = Utf8Path::new(crate::podman::CONTAINER_STORAGE)
520-
.try_exists()?
521-
&& ostree_ext::mountutil::is_mountpoint(
522-
&root,
523-
crate::podman::CONTAINER_STORAGE.trim_start_matches('/'),
524-
)?
525-
.unwrap_or_default();
526-
527-
// Verify up front we can do the fetch
528-
if have_host_container_storage {
529-
tracing::debug!("Host container storage found");
530-
} else {
531-
tracing::debug!(
532-
"No {} mount available, checking skopeo",
533-
crate::podman::CONTAINER_STORAGE
534-
);
535-
require_skopeo_with_containers_storage()?;
536-
}
537-
538-
Self::new(
539-
imageref,
540-
Some(digest),
541-
root,
542-
true,
543-
have_host_container_storage,
544-
)
517+
Self::new(imageref, Some(digest), root, true)
545518
}
546519

547520
#[context("Creating source info from a given imageref")]
548521
pub(crate) fn from_imageref(imageref: &str, root: &Dir) -> Result<Self> {
549522
let imageref = ostree_container::ImageReference::try_from(imageref)?;
550-
Self::new(imageref, None, root, false, false)
523+
Self::new(imageref, None, root, false)
551524
}
552525

553526
fn have_selinux_from_repo(root: &Dir) -> Result<bool> {
@@ -573,7 +546,6 @@ impl SourceInfo {
573546
digest: Option<String>,
574547
root: &Dir,
575548
in_host_mountns: bool,
576-
have_host_container_storage: bool,
577549
) -> Result<Self> {
578550
let selinux = if Path::new("/ostree/repo").try_exists()? {
579551
Self::have_selinux_from_repo(root)?
@@ -585,7 +557,6 @@ impl SourceInfo {
585557
digest,
586558
selinux,
587559
in_host_mountns,
588-
have_host_container_storage,
589560
})
590561
}
591562
}
@@ -716,19 +687,7 @@ async fn install_container(
716687
}
717688
};
718689

719-
// We need to fetch the container image from the root mount namespace. If
720-
// we don't have /var/lib/containers mounted in this image, fork off skopeo
721-
// in the host mountnfs.
722-
let skopeo_cmd = if !state.source.have_host_container_storage {
723-
Some(run_in_host_mountns("skopeo"))
724-
} else {
725-
None
726-
};
727-
let proxy_cfg = ostree_container::store::ImageProxyConfig {
728-
skopeo_cmd,
729-
..Default::default()
730-
};
731-
690+
let proxy_cfg = ostree_container::store::ImageProxyConfig::default();
732691
(src_imageref, Some(proxy_cfg))
733692
};
734693
let src_imageref = ostree_container::OstreeImageReference {
@@ -895,32 +854,6 @@ pub(crate) fn exec_in_host_mountns(args: &[std::ffi::OsString]) -> Result<()> {
895854
Err(Command::new(cmd).args(args).exec()).context("exec")?
896855
}
897856

898-
#[context("Querying skopeo version")]
899-
fn require_skopeo_with_containers_storage() -> Result<()> {
900-
let out = Task::new_cmd("skopeo --version", run_in_host_mountns("skopeo"))
901-
.args(["--version"])
902-
.quiet()
903-
.read()
904-
.context("Failed to run skopeo (it currently must be installed in the host root)")?;
905-
let mut v = out
906-
.strip_prefix("skopeo version ")
907-
.map(|v| v.split('.'))
908-
.ok_or_else(|| anyhow::anyhow!("Unexpected output from skopeo version"))?;
909-
let major = v
910-
.next()
911-
.ok_or_else(|| anyhow::anyhow!("Missing major version"))?;
912-
let minor = v
913-
.next()
914-
.ok_or_else(|| anyhow::anyhow!("Missing minor version"))?;
915-
let (major, minor) = (major.parse::<u64>()?, minor.parse::<u64>()?);
916-
let supported = major > 1 || minor > 10;
917-
if supported {
918-
Ok(())
919-
} else {
920-
anyhow::bail!("skopeo >= 1.11 is required on host")
921-
}
922-
}
923-
924857
pub(crate) struct RootSetup {
925858
luks_device: Option<String>,
926859
device_info: crate::blockdev::PartitionTable,

0 commit comments

Comments
 (0)