Skip to content

Commit

Permalink
Merge pull request #158 from cgwalters/no-s390x-yet
Browse files Browse the repository at this point in the history
Two minor error/logging improvements
  • Loading branch information
jmarrero authored Oct 24, 2023
2 parents 41a08bf + 57d75f6 commit a39cf87
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ rust-version = "1.64.0"
include = ["/src", "LICENSE-APACHE", "LICENSE-MIT"]

[dependencies]
anstream = "0.6.4"
anstyle = "1.0.4"
anyhow = "1.0"
camino = { version = "1.0.4", features = ["serde1"] }
ostree-ext = "0.12"
Expand Down
4 changes: 4 additions & 0 deletions lib/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,10 @@ async fn prepare_install(
crate::cli::require_root()?;
require_systemd_pid1()?;

if cfg!(target_arch = "s390x") {
anyhow::bail!("Installation is not supported on this architecture yet");
}

let rootfs = cap_std::fs::Dir::open_ambient_dir("/", cap_std::ambient_authority())
.context("Opening /")?;

Expand Down
2 changes: 1 addition & 1 deletion lib/src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ pub(crate) async fn status(opts: super::cli::StatusOpts) -> Result<()> {
host
};

eprintln!("note: The format of this API is not yet stable");
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.
Expand Down
9 changes: 9 additions & 0 deletions lib/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ pub(crate) fn spawn_editor(tmpf: &tempfile::NamedTempFile) -> Result<()> {
Ok(())
}

/// Output a warning message
pub(crate) fn warning(s: &str) {
anstream::eprintln!(
"{}{s}{}",
anstyle::AnsiColor::Red.render_fg(),
anstyle::Reset.render()
);
}

/// Given a possibly tagged image like quay.io/foo/bar:latest and a digest 0ab32..., return
/// the digested form quay.io/foo/bar:latest@sha256:0ab32...
/// If the image already has a digest, it will be replaced.
Expand Down

0 comments on commit a39cf87

Please sign in to comment.