Skip to content

Commit a9884a8

Browse files
authored
Remove audit and logger statement from extensions request check (#1828)
Older versions of NervesHubLink would crash if an unknown messages was pushed down over the socket. Since extensions required a new message, this could fail badly on older devices and so a check was put in place to verify the Device API version NHL was reporting to know if it is safe to request extension info or not. This removes the audit log _and_ logger statement that was happening when this safe check would not pass meaning the device version was too old to request. However, this happens with _every_ socket connection and can produce incredible amount of noise. If that level of info is needed, I suggest a future change which shows the device version reported and what that means for support on the device (i.e. in the Device settings page perhaps?)
1 parent 7393ed4 commit a9884a8

File tree

2 files changed

+1
-12
lines changed

2 files changed

+1
-12
lines changed

lib/nerves_hub/audit_logs/templates/device_templates.ex

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,6 @@ defmodule NervesHub.AuditLogs.DeviceTemplates do
2525
AuditLogs.audit!(user, device, description)
2626
end
2727

28-
@spec audit_unsupported_api_version(Device.t()) :: AuditLog.t()
29-
def audit_unsupported_api_version(device) do
30-
description =
31-
"Device #{device.identifier} could not get extensions: Unsupported API version."
32-
33-
Logger.info("[DeviceChannel] #{description}")
34-
35-
AuditLogs.audit!(device, device, description)
36-
end
37-
3828
## Firmware and upgrades
3929

4030
@spec audit_update_attempt(Device.t()) :: AuditLog.t()

lib/nerves_hub_web/channels/device_channel.ex

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ defmodule NervesHubWeb.DeviceChannel do
6767
# Earlier versions of nerves_hub_link don't have a fallback for unknown messages,
6868
# so check version before requesting extensions
6969
if safe_to_request_extensions?(socket.assigns.device_api_version),
70-
do: push(socket, "extensions:get", %{}),
71-
else: DeviceTemplates.audit_unsupported_api_version(device)
70+
do: push(socket, "extensions:get", %{})
7271

7372
{:noreply, socket}
7473
end

0 commit comments

Comments
 (0)