lets GOOOOOOOO

This commit is contained in:
lda
2026-04-28 18:04:07 +07:00 Verified
parent 10baa53e4c
commit aa698a9f4b
10 changed files with 250 additions and 23 deletions
+27 -2
View File
@@ -1,5 +1,5 @@
use anyhow::Result;
use tracing::{debug, info, instrument};
use tracing::{debug, info, instrument, warn};
use crate::config::AgentConfig;
use crate::protocol::{
@@ -70,8 +70,33 @@ async fn dispatch_inventory(req: InventoryRequest, config: &AgentConfig) -> Resu
&config.mac_name_cache_path,
)
.await?;
let observations = match wakey::wakey_linux::dhcp::list_local_observations_from_path(
&config.observation_store_path,
)
.await
{
Ok(observations) => observations
.into_iter()
.filter_map(wakey::local_observation_to_fact)
.collect::<Vec<_>>(),
Err(err) => {
warn!(error = %err, "failed reading local hook observations for inventory command");
Vec::new()
}
};
debug!(
neighbors = neighbors.len(),
leases = leases.len(),
observations = observations.len(),
"dispatching inventory with merged sources"
);
let inventory = wakey_core::DeviceInventory {
devices: wakey::merge_devices(neighbors, wakey::leases_without_state(leases), &query),
devices: wakey::merge_devices_with_observations(
neighbors,
wakey::leases_without_state(leases),
observations,
&query,
),
};
debug!(
rows = inventory.devices.len(),