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

cli: Don't output sigverify+transport for default #339

Merged
merged 1 commit into from
Feb 14, 2024
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
4 changes: 2 additions & 2 deletions lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,11 @@ async fn upgrade(opts: UpgradeOpts) -> Result<()> {
let mut imp = crate::deploy::new_importer(repo, &imgref).await?;
match imp.prepare().await? {
PrepareResult::AlreadyPresent(_) => {
println!("No changes in: {}", imgref);
println!("No changes in: {imgref:#}");
}
PrepareResult::Ready(r) => {
crate::deploy::check_bootc_label(&r.config);
println!("Update available for: {}", imgref);
println!("Update available for: {imgref:#}");
if let Some(version) = r.version() {
println!(" Version: {version}");
}
Expand Down
8 changes: 4 additions & 4 deletions lib/src/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ pub(crate) async fn pull(
quiet: bool,
) -> Result<Box<ImageState>> {
let repo = &sysroot.repo();
let imgref = &OstreeImageReference::from(imgref.clone());
let mut imp = new_importer(repo, imgref).await?;
let ostree_imgref = &OstreeImageReference::from(imgref.clone());
let mut imp = new_importer(repo, ostree_imgref).await?;
let prep = match imp.prepare().await? {
PrepareResult::AlreadyPresent(c) => {
println!("No changes in {} => {}", imgref, c.manifest_digest);
println!("No changes in {imgref:#} => {}", c.manifest_digest);
return Ok(Box::new((*c).into()));
}
PrepareResult::Ready(p) => p,
Expand All @@ -146,7 +146,7 @@ pub(crate) async fn pull(
}
let import = import?;
if let Some(msg) =
ostree_container::store::image_filtered_content_warning(repo, &imgref.imgref)?
ostree_container::store::image_filtered_content_warning(repo, &ostree_imgref.imgref)?
{
crate::journal::journal_print(libsystemd::logging::Priority::Notice, &msg);
}
Expand Down
18 changes: 16 additions & 2 deletions lib/src/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,13 @@ impl Default for Host {

impl Display for ImageReference {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let ostree_imgref = OstreeImageReference::from(self.clone());
ostree_imgref.fmt(f)
// For the default of fetching from a remote registry, just output the image name
if f.alternate() && self.signature.is_none() && self.transport == "registry" {
self.image.fmt(f)
} else {
let ostree_imgref = OstreeImageReference::from(self.clone());
ostree_imgref.fmt(f)
}
}
}

Expand Down Expand Up @@ -203,5 +208,14 @@ mod tests {
let s = ImageReference::from(s);
let displayed = format!("{s}");
assert_eq!(displayed.as_str(), src);
// Alternative display should be short form
assert_eq!(format!("{s:#}"), "quay.io/example/foo:sometag");

let src = "ostree-remote-image:fedora:docker://quay.io/example/foo:sometag";
let s = OstreeImageReference::from_str(src).unwrap();
let s = ImageReference::from(s);
let displayed = format!("{s}");
assert_eq!(displayed.as_str(), src);
assert_eq!(format!("{s:#}"), src);
}
}
Loading