Skip to content

Commit a39cf87

Browse files
authored
Merge pull request #158 from cgwalters/no-s390x-yet
Two minor error/logging improvements
2 parents 41a08bf + 57d75f6 commit a39cf87

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

lib/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ rust-version = "1.64.0"
1111
include = ["/src", "LICENSE-APACHE", "LICENSE-MIT"]
1212

1313
[dependencies]
14+
anstream = "0.6.4"
15+
anstyle = "1.0.4"
1416
anyhow = "1.0"
1517
camino = { version = "1.0.4", features = ["serde1"] }
1618
ostree-ext = "0.12"

lib/src/install.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,10 @@ async fn prepare_install(
790790
crate::cli::require_root()?;
791791
require_systemd_pid1()?;
792792

793+
if cfg!(target_arch = "s390x") {
794+
anyhow::bail!("Installation is not supported on this architecture yet");
795+
}
796+
793797
let rootfs = cap_std::fs::Dir::open_ambient_dir("/", cap_std::ambient_authority())
794798
.context("Opening /")?;
795799

lib/src/status.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ pub(crate) async fn status(opts: super::cli::StatusOpts) -> Result<()> {
262262
host
263263
};
264264

265-
eprintln!("note: The format of this API is not yet stable");
265+
crate::utils::warning("note: The format of this API is not yet stable");
266266

267267
// If we're in JSON mode, then convert the ostree data into Rust-native
268268
// structures that can be serialized.

lib/src/utils.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ pub(crate) fn spawn_editor(tmpf: &tempfile::NamedTempFile) -> Result<()> {
6060
Ok(())
6161
}
6262

63+
/// Output a warning message
64+
pub(crate) fn warning(s: &str) {
65+
anstream::eprintln!(
66+
"{}{s}{}",
67+
anstyle::AnsiColor::Red.render_fg(),
68+
anstyle::Reset.render()
69+
);
70+
}
71+
6372
/// Given a possibly tagged image like quay.io/foo/bar:latest and a digest 0ab32..., return
6473
/// the digested form quay.io/foo/bar:latest@sha256:0ab32...
6574
/// If the image already has a digest, it will be replaced.

0 commit comments

Comments
 (0)