WIP2
This commit is contained in:
@@ -140,10 +140,53 @@ pub fn host_check_deps() -> Result<HostCheckReport, HostCheckError> {
|
||||
let _ = fs::remove_file(&probe_path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Optional Mycelium IPv6 checks when enabled via env
|
||||
let ipv6_env = std::env::var("HERO_VIRT_IPV6_ENABLE").unwrap_or_else(|_| "".into());
|
||||
let ipv6_enabled = ipv6_env.eq_ignore_ascii_case("1") || ipv6_env.eq_ignore_ascii_case("true");
|
||||
if ipv6_enabled {
|
||||
// Require mycelium CLI
|
||||
if bin_missing("mycelium") {
|
||||
critical.push("mycelium CLI not found on PATH (required when HERO_VIRT_IPV6_ENABLE=true)".into());
|
||||
}
|
||||
// Validate interface presence and global IPv6
|
||||
let ifname = std::env::var("HERO_VIRT_MYCELIUM_IF").unwrap_or_else(|_| "mycelium".into());
|
||||
let check_if = sal_process::run(&format!("ip -6 addr show dev {}", ifname))
|
||||
.silent(true)
|
||||
.die(false)
|
||||
.execute();
|
||||
match check_if {
|
||||
Ok(r) if r.success => {
|
||||
let out = r.stdout;
|
||||
if !(out.contains("inet6") && out.contains("scope global")) {
|
||||
notes.push(format!(
|
||||
"iface '{}' present but no global IPv6 detected; Mycelium may not be up yet",
|
||||
ifname
|
||||
));
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
critical.push(format!(
|
||||
"iface '{}' not found or no IPv6; ensure Mycelium is running",
|
||||
ifname
|
||||
));
|
||||
}
|
||||
}
|
||||
// Best-effort: parse `mycelium inspect` for Address
|
||||
let insp = sal_process::run("mycelium inspect").silent(true).die(false).execute();
|
||||
match insp {
|
||||
Ok(res) if res.success && res.stdout.contains("Address:") => {
|
||||
// good enough
|
||||
}
|
||||
_ => {
|
||||
notes.push("`mycelium inspect` did not return an Address; IPv6 overlay may be unavailable".into());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Summarize ok flag
|
||||
let ok = critical.is_empty();
|
||||
|
||||
|
||||
Ok(HostCheckReport {
|
||||
ok,
|
||||
critical,
|
||||
|
Reference in New Issue
Block a user