mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 04:04:45 +00:00
Revert "kata-ctl: Disable network check on s390x"
This reverts commit 00981b3c0a
.
Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
This commit is contained in:
parent
dd60a0298d
commit
9f2c7e47c9
@ -12,12 +12,9 @@ edition = "2018"
|
||||
[dependencies]
|
||||
anyhow = "1.0.31"
|
||||
clap = { version = "3.2.20", features = ["derive", "cargo"] }
|
||||
reqwest = { version = "0.11", default-features = false, features = ["json", "blocking", "rustls-tls"] }
|
||||
serde_json = "1.0.85"
|
||||
thiserror = "1.0.35"
|
||||
|
||||
# See: https://github.com/kata-containers/kata-containers/issues/5438
|
||||
[target.'cfg(not(target_arch = "s390x"))'.dependencies]
|
||||
reqwest = { version = "0.11", default-features = false, features = ["json", "blocking", "rustls-tls"] }
|
||||
|
||||
[dev-dependencies]
|
||||
semver = "1.0.12"
|
||||
|
@ -6,19 +6,8 @@
|
||||
// Contains checks that are not architecture-specific
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
// See: https://github.com/kata-containers/kata-containers/issues/5438
|
||||
#[cfg(any(
|
||||
target_arch = "aarch64",
|
||||
target_arch = "powerpc64le",
|
||||
target_arch = "x86_64"
|
||||
))]
|
||||
use reqwest::header::{CONTENT_TYPE, USER_AGENT};
|
||||
use serde_json::Value;
|
||||
#[cfg(any(
|
||||
target_arch = "aarch64",
|
||||
target_arch = "powerpc64le",
|
||||
target_arch = "x86_64"
|
||||
))]
|
||||
use std::collections::HashMap;
|
||||
use std::fs;
|
||||
|
||||
@ -110,11 +99,6 @@ pub fn run_network_checks() -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(any(
|
||||
target_arch = "aarch64",
|
||||
target_arch = "powerpc64le",
|
||||
target_arch = "x86_64"
|
||||
))]
|
||||
fn get_kata_version_by_url(url: &str) -> std::result::Result<String, reqwest::Error> {
|
||||
let content = reqwest::blocking::Client::new()
|
||||
.get(url)
|
||||
@ -127,11 +111,6 @@ fn get_kata_version_by_url(url: &str) -> std::result::Result<String, reqwest::Er
|
||||
Ok(version.to_string())
|
||||
}
|
||||
|
||||
#[cfg(any(
|
||||
target_arch = "aarch64",
|
||||
target_arch = "powerpc64le",
|
||||
target_arch = "x86_64"
|
||||
))]
|
||||
fn handle_reqwest_error(e: reqwest::Error) -> anyhow::Error {
|
||||
if e.is_connect() {
|
||||
return anyhow!(e).context("http connection failure: connection refused");
|
||||
@ -152,11 +131,6 @@ fn handle_reqwest_error(e: reqwest::Error) -> anyhow::Error {
|
||||
anyhow!(e).context("unknown http connection failure: {:?}")
|
||||
}
|
||||
|
||||
#[cfg(any(
|
||||
target_arch = "aarch64",
|
||||
target_arch = "powerpc64le",
|
||||
target_arch = "x86_64"
|
||||
))]
|
||||
pub fn check_version() -> Result<()> {
|
||||
let version = get_kata_version_by_url(KATA_GITHUB_URL).map_err(handle_reqwest_error)?;
|
||||
|
||||
@ -190,11 +164,6 @@ mod tests {
|
||||
assert_eq!(expected, actual);
|
||||
}
|
||||
|
||||
#[cfg(any(
|
||||
target_arch = "aarch64",
|
||||
target_arch = "powerpc64le",
|
||||
target_arch = "x86_64"
|
||||
))]
|
||||
#[test]
|
||||
fn check_version_by_empty_url() {
|
||||
const TEST_URL: &str = "http:";
|
||||
@ -203,11 +172,6 @@ mod tests {
|
||||
assert_eq!(expected, actual);
|
||||
}
|
||||
|
||||
#[cfg(any(
|
||||
target_arch = "aarch64",
|
||||
target_arch = "powerpc64le",
|
||||
target_arch = "x86_64"
|
||||
))]
|
||||
#[test]
|
||||
fn check_version_by_garbage_url() {
|
||||
const TEST_URL: &str = "_localhost_";
|
||||
@ -216,11 +180,6 @@ mod tests {
|
||||
assert_eq!(expected, actual);
|
||||
}
|
||||
|
||||
#[cfg(any(
|
||||
target_arch = "aarch64",
|
||||
target_arch = "powerpc64le",
|
||||
target_arch = "x86_64"
|
||||
))]
|
||||
#[test]
|
||||
fn check_version_by_invalid_url() {
|
||||
const TEST_URL: &str = "http://localhost :80";
|
||||
@ -229,11 +188,6 @@ mod tests {
|
||||
assert_eq!(expected, actual);
|
||||
}
|
||||
|
||||
#[cfg(any(
|
||||
target_arch = "aarch64",
|
||||
target_arch = "powerpc64le",
|
||||
target_arch = "x86_64"
|
||||
))]
|
||||
#[test]
|
||||
fn check_latest_version() {
|
||||
let version = get_kata_version_by_url(KATA_GITHUB_URL).unwrap();
|
||||
|
@ -32,16 +32,7 @@ pub fn handle_check(checkcmd: CheckArgument) -> Result<()> {
|
||||
|
||||
CheckSubCommand::CheckVersionOnly => {
|
||||
// retrieve latest release
|
||||
#[cfg(any(
|
||||
target_arch = "aarch64",
|
||||
target_arch = "powerpc64le",
|
||||
target_arch = "x86_64"
|
||||
))]
|
||||
check::check_version()?;
|
||||
|
||||
// See: https://github.com/kata-containers/kata-containers/issues/5438
|
||||
#[cfg(target_arch = "s390x")]
|
||||
unimplemented!("Network check not implemented on s390x")
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user