systemd: parse static machines list, render placeholders (step 3)
This commit is contained in:
parent
3fb9a36f3b
commit
6224d86965
1 changed files with 68 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Reference in a new issue