systemd: parse static machines list, render placeholders (step 3)

This commit is contained in:
Damocles 2026-05-07 20:00:39 +02:00
commit 6224d86965

View file

@ -6,6 +6,7 @@
// to require QuickControls2.prl files that nixpkgs strips. Switch to
// QList<QVariantMap> when a release ships with both fixes.
use crate::modules_service;
use core::pin::Pin;
use cxx_qt_lib::QString;
use serde::Serialize;
@ -270,6 +271,28 @@ impl qobject::SystemdService {
});
}
// Configured remote machines (placeholders; transport lands in step 4).
// Dedup local: drop entries matching the local hostname or `localhost`,
// with or without a `user@` prefix.
let host = read_hostname();
let cfg_machines = modules_service::load_systemd_machines();
for target in cfg_machines {
let host_part = target.rsplit_once('@').map_or(target.as_str(), |(_, h)| h);
if host_part == host || host_part == "localhost" {
continue;
}
all_machines.push(MachineJson {
name: target.clone(),
is_local: false,
marker: String::new(),
system_state: "pending".into(),
running_count: 0,
total_count: 0,
failed_units: Vec::new(),
running_units: Vec::new(),
});
}
let machines_json = serde_json::to_string(&all_machines).unwrap_or_else(|_| "[]".into());
self.as_mut().set_failed_count(local_failed_count);