From 95c6f53d1508057bdc927697fa5f5394cdd2c9f7 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Wed, 4 Feb 2026 18:22:12 -0600 Subject: [PATCH] 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. --- lib/towerops/profiles/yaml_profiles.ex | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/towerops/profiles/yaml_profiles.ex b/lib/towerops/profiles/yaml_profiles.ex index cae73b2e..15e6d981 100644 --- a/lib/towerops/profiles/yaml_profiles.ex +++ b/lib/towerops/profiles/yaml_profiles.ex @@ -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)