Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install: Two smaller fixes #228

Merged
merged 2 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,10 @@ pub(crate) enum Opt {
/// Execute the given command in the host mount namespace
#[cfg(feature = "install")]
#[clap(hide = true)]
#[command(external_subcommand)]
ExecInHostMountNamespace(Vec<OsString>),

ExecInHostMountNamespace {
#[clap(trailing_var_arg = true, allow_hyphen_values = true)]
args: Vec<OsString>,
},
/// Internal integration testing helpers.
#[clap(hide(true), subcommand)]
#[cfg(feature = "internal-testing-api")]
Expand Down Expand Up @@ -468,7 +469,7 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
InstallOpts::ToFilesystem(opts) => crate::install::install_to_filesystem(opts).await,
},
#[cfg(feature = "install")]
Opt::ExecInHostMountNamespace(args) => {
Opt::ExecInHostMountNamespace { args } => {
crate::install::exec_in_host_mountns(args.as_slice())
}
Opt::Status(opts) => super::status::status(opts).await,
Expand Down
3 changes: 2 additions & 1 deletion lib/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ pub(crate) fn run_in_host_mountns(cmd: &str) -> Command {

#[context("Re-exec in host mountns")]
pub(crate) fn exec_in_host_mountns(args: &[std::ffi::OsString]) -> Result<()> {
let (cmd, args) = args[1..]
let (cmd, args) = args
.split_first()
.ok_or_else(|| anyhow::anyhow!("Missing command"))?;
tracing::trace!("{cmd:?} {args:?}");
Expand All @@ -694,6 +694,7 @@ fn skopeo_supports_containers_storage() -> Result<bool> {
let o = run_in_host_mountns("skopeo").arg("--version").output()?;
let st = o.status;
if !st.success() {
let _ = std::io::copy(&mut std::io::Cursor::new(o.stderr), &mut std::io::stderr()); // Ignore errors copying stderr
anyhow::bail!("Failed to run skopeo --version: {st:?}");
}
let stdout = String::from_utf8(o.stdout).context("Parsing skopeo version")?;
Expand Down