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:
parent
ff89415ed3
commit
95c6f53d15
1 changed files with 4 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue