Connect passive signed release checks to compatible Linux inventory
Rust development slice / linux (push) Failing after 6s

This commit is contained in:
2026-11-15 14:11:06 +01:00
parent c1d8eea6b8
commit 098f32e24f
12 changed files with 1287 additions and 2 deletions
+29
View File
@@ -1,3 +1,4 @@
mod agent_update_catalog;
mod agent_update_health;
mod apt;
mod bootstrap;
@@ -60,6 +61,7 @@ struct Agent<C: reconcile::SyncClock = reconcile::NativeClock> {
mode: wire_channel::Mode,
certificates: certificate_rotation::RotationStore,
rotation_policy: certificate_rotation::RotationPolicy,
catalog: agent_update_catalog::Checker,
}
#[derive(Default)]
struct EffectFence {
@@ -495,7 +497,9 @@ impl<C: reconcile::SyncClock> Agent<C> {
let sender = self.inventory_tx.clone();
let extended = env::var("RMM_EXTENDED_INVENTORY").unwrap_or_else(|_| "1".into()) == "1";
let binding = self.binding.clone();
let catalog = self.catalog.cached(Utc::now());
tokio::task::spawn_blocking(move || {
let collected_at = Utc::now();
let result = rmm_agent_linux::wire::snapshot(extended).and_then(|mut inventory| {
if extended {
inventory["observations"]
@@ -504,6 +508,17 @@ impl<C: reconcile::SyncClock> Agent<C> {
.push(apt::planning_observation(binding.as_ref()));
inventory["collection_completed_at"] = serde_json::json!(Utc::now());
}
if let Some(report) = catalog {
if inventory.get("observations").is_none() {
inventory["observations"] = serde_json::json!([]);
inventory["collection_started_at"] = serde_json::json!(collected_at);
}
inventory["observations"]
.as_array_mut()
.context("INVENTORY_OBSERVATIONS")?
.push(agent_update_catalog::observation(report, Utc::now()));
inventory["collection_completed_at"] = serde_json::json!(Utc::now());
}
let bytes = serde_json::to_vec(&inventory)?;
ensure!(bytes.len() <= 512 * 1024, "INVENTORY_WIRE_LIMIT");
Ok((bytes, Utc::now().timestamp_millis()))
@@ -522,6 +537,19 @@ impl<C: reconcile::SyncClock> Agent<C> {
rmm_domain::agent_update::Platform::LinuxX64,
Utc::now(),
);
let address = self.address;
let ca = &self.ca;
let certificates = &self.certificates;
self.catalog
.poll(self.binding.as_ref(), self.clock.clone(), address, || {
let identity = certificates.current(Utc::now().timestamp())?;
https_channel::mtls_client(
address,
ca,
&identity.certificate_pem,
&identity.private_key_pem,
)
});
let data = serde_json::to_vec(&serde_json::json!({"agent_update":observation}))?;
let envelope = self.envelope(
generation,
@@ -988,6 +1016,7 @@ async fn main() -> Result<()> {
mode,
certificates,
rotation_policy,
catalog: agent_update_catalog::Checker::default(),
};
agent.recover_interrupted()?;
let mut backoff = 1_u64;