From 6c4a77a205157c657829838b2b77316aabebda1f Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 7 Aug 2023 16:48:11 +0200 Subject: [PATCH] Fix filter list update warning on setting change --- intel/customlists/module.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/intel/customlists/module.go b/intel/customlists/module.go index 3589b06d..d33ac4f2 100644 --- a/intel/customlists/module.go +++ b/intel/customlists/module.go @@ -2,7 +2,7 @@ package customlists import ( "context" - "fmt" + "errors" "net" "os" "regexp" @@ -35,6 +35,10 @@ var ( filterListLock sync.RWMutex parserTask *modules.Task + + // ErrNotConfigured is returned when updating the custom filter list, but it + // is not configured. + ErrNotConfigured = errors.New("custom filter list not configured") ) func init() { @@ -78,7 +82,10 @@ func start() error { configChangeEvent, "update custom filter list", func(ctx context.Context, obj interface{}) error { - return checkAndUpdateFilterList() + if err := checkAndUpdateFilterList(); !errors.Is(err, ErrNotConfigured) { + return err + } + return nil }, ); err != nil { return err @@ -100,7 +107,7 @@ func checkAndUpdateFilterList() error { // Get path and return error if empty filePath := getFilePath() if filePath == "" { - return fmt.Errorf("custom filter list setting is empty") + return ErrNotConfigured } // Schedule next update check