Skip to content

Commit

Permalink
Merge pull request #298 from cgwalters/drop-status-warning
Browse files Browse the repository at this point in the history
Drop status warning
  • Loading branch information
cgwalters authored Feb 2, 2024
2 parents eb0d270 + e675cbf commit 8558c96
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions lib/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1018,8 +1018,9 @@ pub(crate) async fn install_to_disk(mut opts: InstallToDiskOpts) -> Result<()> {
.with_context(|| format!("Querying {}", &block_opts.device))?;
if opts.via_loopback {
if !opts.config_opts.generic_image {
eprintln!("Automatically enabling --generic-image when installing via loopback");
std::thread::sleep(std::time::Duration::from_secs(2));
crate::utils::medium_visibility_warning(
"Automatically enabling --generic-image when installing via loopback",
);
opts.config_opts.generic_image = true;
}
if !target_blockdev_meta.file_type().is_file() {
Expand Down
2 changes: 0 additions & 2 deletions lib/src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,6 @@ pub(crate) async fn status(opts: super::cli::StatusOpts) -> Result<()> {
host
};

crate::utils::warning("note: The format of this API is not yet stable");

// If we're in JSON mode, then convert the ostree data into Rust-native
// structures that can be serialized.
// Filter to just the serializable status structures.
Expand Down
7 changes: 5 additions & 2 deletions lib/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,16 @@ pub(crate) fn sigpolicy_from_opts(
}
}

/// Output a warning message
pub(crate) fn warning(s: &str) {
/// Output a warning message that we want to be quite visible.
/// The process (thread) execution will be delayed for a short time.
pub(crate) fn medium_visibility_warning(s: &str) {
anstream::eprintln!(
"{}{s}{}",
anstyle::AnsiColor::Red.render_fg(),
anstyle::Reset.render()
);
// When warning, add a sleep to ensure it's seen
std::thread::sleep(std::time::Duration::from_secs(1));
}

/// Given a possibly tagged image like quay.io/foo/bar:latest and a digest 0ab32..., return
Expand Down

0 comments on commit 8558c96

Please sign in to comment.