From b78b43bf47c4afa6cf626c5ce25c626591b43e56 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 28 Aug 2023 09:18:11 -0400 Subject: [PATCH] cli/unencapsulate: Add proxy options We need to support all the proxy options so that custom authentication files can be supported, etc. Closes: https://github.com/ostreedev/ostree/issues/3015 --- lib/src/cli.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/src/cli.rs b/lib/src/cli.rs index 949e3310..c1513502 100644 --- a/lib/src/cli.rs +++ b/lib/src/cli.rs @@ -88,6 +88,9 @@ pub(crate) enum ContainerOpts { #[clap(long, value_parser)] repo: Utf8PathBuf, + #[clap(flatten)] + proxyopts: ContainerProxyOpts, + /// Image reference, e.g. registry:quay.io/exampleos/exampleos:latest #[clap(value_parser = parse_imgref)] imgref: OstreeImageReference, @@ -571,6 +574,7 @@ pub async fn print_deprecated_warning(msg: &str) { async fn container_import( repo: &ostree::Repo, imgref: &OstreeImageReference, + proxyopts: ContainerProxyOpts, write_ref: Option<&str>, quiet: bool, ) -> Result<()> { @@ -584,7 +588,7 @@ async fn container_import( pb.set_message("Downloading..."); pb }); - let importer = ImageImporter::new(repo, imgref, Default::default()).await?; + let importer = ImageImporter::new(repo, imgref, proxyopts.into()).await?; let import = importer.unencapsulate().await; // Ensure we finish the progress bar before potentially propagating an error if let Some(pb) = pb.as_ref() { @@ -831,11 +835,12 @@ async fn run_from_opt(opt: Opt) -> Result<()> { ContainerOpts::Unencapsulate { repo, imgref, + proxyopts, write_ref, quiet, } => { let repo = parse_repo(&repo)?; - container_import(&repo, &imgref, write_ref.as_deref(), quiet).await + container_import(&repo, &imgref, proxyopts, write_ref.as_deref(), quiet).await } ContainerOpts::Encapsulate { repo,