Skip to content
Closed
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
3 changes: 3 additions & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ disallowed-methods = [
# https://github.com/rust-lang/rust-clippy/issues/13434#issuecomment-2484292914
{ path = "str::len", reason = "use <str>.as_bytes().len() instead" }
]

# Printing from tests is fine; see the print_stdout deny in crates/lib
allow-print-in-tests = true
6 changes: 3 additions & 3 deletions crates/lib/src/bootc_composefs/rollback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ pub(crate) async fn composefs_rollback(

let reverting = new_spec.boot_order == BootOrder::Default;
if reverting {
println!("notice: Reverting queued rollback state");
cli_status!("notice: Reverting queued rollback state");
}

let rollback_status = host
Expand Down Expand Up @@ -269,9 +269,9 @@ pub(crate) async fn composefs_rollback(
}

if reverting {
println!("Next boot: current deployment");
cli_status!("Next boot: current deployment");
} else {
println!("Next boot: rollback deployment");
cli_status!("Next boot: rollback deployment");
}

Ok(())
Expand Down
8 changes: 4 additions & 4 deletions crates/lib/src/bootc_composefs/soft_reboot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub(crate) fn reset_soft_reboot() -> Result<()> {

let Some(nextroot) = nextroot else {
tracing::debug!("Nextroot does not exist");
println!("No deployment staged for soft rebooting");
cli_status!("No deployment staged for soft rebooting");
return Ok(());
};

Expand All @@ -50,13 +50,13 @@ pub(crate) fn reset_soft_reboot() -> Result<()> {

if !nextroot_mounted {
tracing::debug!("Nextroot is not a mountpoint");
println!("No deployment staged for soft rebooting");
cli_status!("No deployment staged for soft rebooting");
return Ok(());
}

unmount(NEXTROOT, UnmountFlags::DETACH).context("Unmounting nextroot")?;

println!("Cleared soft reboot queued state");
cli_status!("Cleared soft reboot queued state");

Ok(())
}
Expand Down Expand Up @@ -133,7 +133,7 @@ pub(crate) async fn prepare_soft_reboot_composefs(

setup_root(args)?;

println!("Soft reboot setup complete");
cli_status!("Soft reboot setup complete");

if reboot {
// Replacing the current process should be fine as we restart userspace anyway
Expand Down
6 changes: 3 additions & 3 deletions crates/lib/src/bootc_composefs/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ pub(crate) async fn write_composefs_state(
pub(crate) fn composefs_usr_overlay(access_mode: FilesystemOverlayAccessMode) -> Result<()> {
let status = get_composefs_usr_overlay_status()?;
if status.is_some() {
println!("An overlayfs is already mounted on /usr");
cli_status!("An overlayfs is already mounted on /usr");
return Ok(());
}

Expand All @@ -345,8 +345,8 @@ pub(crate) fn composefs_usr_overlay(access_mode: FilesystemOverlayAccessMode) ->
let overlay_fd = overlay_transient(usr.as_fd(), "transient", mount_attr_flags)?;
mount_at_wrapper(overlay_fd, &usr, ".").context("Attaching /usr overlay")?;

println!("A {} overlayfs is now mounted on /usr", access_mode);
println!("All changes there will be discarded on reboot.");
cli_status!("A {} overlayfs is now mounted on /usr", access_mode);
cli_status!("All changes there will be discarded on reboot.");

Ok(())
}
Expand Down
4 changes: 2 additions & 2 deletions crates/lib/src/bootc_composefs/switch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub(crate) async fn switch_composefs(
};

if new_spec == host.spec {
println!("Image specification is unchanged.");
cli_status!("Image specification is unchanged.");
if opts.apply && host.status.staged.is_some() {
crate::reboot::reboot()?;
}
Expand Down Expand Up @@ -106,7 +106,7 @@ pub(crate) async fn switch_composefs(

match action {
UpdateAction::Skip => {
println!("No changes in image: {target_imgref:#}");
cli_status!("No changes in image: {target_imgref:#}");
return Ok(());
}

Expand Down
10 changes: 5 additions & 5 deletions crates/lib/src/bootc_composefs/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,8 @@ pub(crate) async fn apply_upgrade_from_downloaded(

// Staged deployment exists, but it will be finalized
if !staged.download_only {
println!("Staged deployment is present and not in download only mode.");
println!("Use `bootc update --apply` to apply the update.");
cli_status!("Staged deployment is present and not in download only mode.");
cli_status!("Use `bootc update --apply` to apply the update.");
return Ok(());
}

Expand Down Expand Up @@ -541,7 +541,7 @@ pub(crate) async fn upgrade_composefs(
return crate::reboot::reboot();
}

println!("Update already staged. To apply update run `bootc update --apply`");
cli_status!("Update already staged. To apply update run `bootc update --apply`");

return Ok(());
}
Expand All @@ -566,7 +566,7 @@ pub(crate) async fn upgrade_composefs(

match action {
UpdateAction::Skip => {
println!("No changes in staged image: {booted_imgref:#}");
cli_status!("No changes in staged image: {booted_imgref:#}");
return Ok(());
}

Expand Down Expand Up @@ -598,7 +598,7 @@ pub(crate) async fn upgrade_composefs(

match action {
UpdateAction::Skip => {
println!("No changes in: {booted_imgref:#}");
cli_status!("No changes in: {booted_imgref:#}");
return Ok(());
}

Expand Down
8 changes: 4 additions & 4 deletions crates/lib/src/bootloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ pub(crate) fn install_via_bootupd(
"/"
};

println!("Installing bootloader via bootupd");
cli_status!("Installing bootloader via bootupd");

// Build the bootupctl arguments
let mut bootupd_args: Vec<&str> = vec!["backend", "install"];
Expand Down Expand Up @@ -269,7 +269,7 @@ pub(crate) fn install_systemd_boot(
configopts: &crate::install::InstallConfigOpts,
autoenroll: Option<SecurebootKeys>,
) -> Result<()> {
println!("Installing bootloader via systemd-boot");
cli_status!("Installing bootloader via systemd-boot");

// We use the --root of the mounted target root, so we have the right /etc/os-release.
let root_path = prepared_root
Expand Down Expand Up @@ -347,7 +347,7 @@ pub(crate) fn install_systemd_boot(
}
dir.copy(filename, &keys_dir, filename)
.with_context(|| format!("Copying secure boot key {filename:?}"))?;
println!(
cli_status!(
"Wrote Secure Boot key: {}/{}",
keys_path.display(),
filename.as_str()
Expand Down Expand Up @@ -452,7 +452,7 @@ pub(crate) fn install_via_zipl(device: &bootc_blockdev::Device, boot_uuid: &str)
let ramdisk = boot_dir.join(initrd).canonicalize_utf8()?;

// Execute the zipl command to install bootloader
println!("Running zipl on {device_path}");
cli_status!("Running zipl on {device_path}");
Command::new("zipl")
.args(["--target", boot_dir.as_str()])
.args(["--image", image.as_str()])
Expand Down
2 changes: 1 addition & 1 deletion crates/lib/src/boundimage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ pub(crate) async fn pull_images_impl(
.await?;
}

println!("Bound images stored: {n}");
cli_status!("Bound images stored: {n}");

Ok(())
}
Expand Down
Loading
Loading