From 184c2bc999793bc439a4c7f77e9d7cd0fd7c301d Mon Sep 17 00:00:00 2001 From: mayor Date: Fri, 6 Feb 2026 12:06:30 -0600 Subject: [PATCH] fix: Use snmp_device.id for sync_processors and sync_storage Fixes KeyError when processing processors/storage during agent polling. The sync_processors and sync_storage functions expect device.id to be the snmp_device id, not the main device id. Changed from: %{device_id: device.id} To: %{id: device.snmp_device.id} This matches the expected structure for these sync functions which query where snmp_device_id == device.id. --- lib/towerops_web/channels/agent_channel.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/towerops_web/channels/agent_channel.ex b/lib/towerops_web/channels/agent_channel.ex index 19dc67b3..f60bb357 100644 --- a/lib/towerops_web/channels/agent_channel.ex +++ b/lib/towerops_web/channels/agent_channel.ex @@ -998,7 +998,7 @@ defmodule ToweropsWeb.AgentChannel do # Process processors case Base.discover_processors(client_opts) do {:ok, processors} when processors != [] -> - discovered_device = %{device_id: device.id} + discovered_device = %{id: device.snmp_device.id} Towerops.Snmp.Discovery.sync_processors(discovered_device, processors) _ -> @@ -1008,7 +1008,7 @@ defmodule ToweropsWeb.AgentChannel do # Process storage case Base.discover_storage(client_opts) do {:ok, storage} when storage != [] -> - discovered_device = %{device_id: device.id} + discovered_device = %{id: device.snmp_device.id} Towerops.Snmp.Discovery.sync_storage(discovered_device, storage) _ ->