fix: handle nil sys_descr in profile matching

Fixes FunctionClauseError when sys_descr is nil during device profile
matching. Added nil check before attempting String.contains? comparison.
This commit is contained in:
Graham McIntire 2026-02-04 18:22:12 -06:00
parent ff89415ed3
commit 95c6f53d15
No known key found for this signature in database

View file

@ -783,6 +783,10 @@ defmodule Towerops.Profiles.YamlProfiles do
patterns == [] and regexes == [] ->
true
# sys_descr is nil - cannot match patterns/regexes
is_nil(sys_descr) ->
false
# Has pattern constraints - must match at least one
patterns != [] ->
Enum.any?(patterns, fn pattern -> String.contains?(sys_descr, pattern) end)