Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

Commit

Permalink
cli/unencapsulate: Add proxy options
Browse files Browse the repository at this point in the history
We need to support all the proxy options so that custom
authentication files can be supported, etc.

Closes: ostreedev/ostree#3015
  • Loading branch information
cgwalters committed Aug 28, 2023
1 parent 46fe6df commit b78b43b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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<()> {
Expand All @@ -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() {
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit b78b43b

Please sign in to comment.