Skip to content

Commit

Permalink
Merge pull request #412 from cgwalters/more-startup-tracing
Browse files Browse the repository at this point in the history
install: Add some more debug/trace calls
  • Loading branch information
jeckersb committed Mar 21, 2024
2 parents 74fbfa3 + 79275c2 commit 532815a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ pub(crate) fn require_root() -> Result<()> {
if !rustix::thread::capability_is_in_bounding_set(rustix::thread::Capability::SystemAdmin)? {
anyhow::bail!("This command requires full root privileges (CAP_SYS_ADMIN)");
}
tracing::trace!("Verified uid 0 with CAP_SYS_ADMIN");
Ok(())
}

Expand Down
4 changes: 4 additions & 0 deletions lib/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ impl SourceInfo {
transport: ostree_container::Transport::ContainerStorage,
name: container_info.image.clone(),
};
tracing::debug!("Finding digest for image ID {}", container_info.imageid);
let digest = crate::podman::imageid_to_digest(&container_info.imageid)?;

let root = Dir::open_ambient_dir("/", cap_std::ambient_authority())?;
Expand Down Expand Up @@ -852,6 +853,7 @@ fn require_host_pidns() -> Result<()> {
if rustix::process::getpid().is_init() {
anyhow::bail!("This command must be run with --pid=host")
}
tracing::trace!("OK: we're not pid 1");
Ok(())
}

Expand Down Expand Up @@ -979,6 +981,7 @@ async fn prepare_install(
source_opts: InstallSourceOpts,
target_opts: InstallTargetOpts,
) -> Result<Arc<State>> {
tracing::trace!("Preparing install");
// We need full root privileges, i.e. --privileged in podman
crate::cli::require_root()?;
require_host_pidns()?;
Expand All @@ -1000,6 +1003,7 @@ async fn prepare_install(
"Cannot install from rootless podman; this command must be run as root"
);
}
tracing::trace!("Read container engine info {:?}", container_info.engine);

SourceInfo::from_container(&container_info)?
}
Expand Down

0 comments on commit 532815a

Please sign in to comment.