Skip to content

Commit

Permalink
Add a filter to exclude applications
Browse files Browse the repository at this point in the history
Fixes: #1092
Signed-off-by: Aurélien Bompard <[email protected]>
  • Loading branch information
abompard committed Oct 11, 2024
1 parent 66b3c69 commit 87cf54f
Show file tree
Hide file tree
Showing 12 changed files with 464 additions and 76 deletions.
1 change: 1 addition & 0 deletions changelog.d/1092.added
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a filter to exclude applications
1 change: 1 addition & 0 deletions fmn/api/api_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def address_format(cls, v, info: FieldValidationInfo):

class Filters(BaseModel):
applications: list[str] = []
excluded_applications: list[str] = []
severities: list[str] = []
topic: str | None = None
my_actions: bool = False
Expand Down
9 changes: 9 additions & 0 deletions fmn/rules/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ def matches(self, message):
return message.app_name.lower() in self.params


class ExcludedApplications(Applications):
name = "excluded_applications"

def matches(self, message):
if not self.params:
return True
return message.app_name.lower() not in self.params


class Severities(Filter):
name = "severities"
default = (message.INFO, message.WARNING, message.ERROR)
Expand Down
Loading

0 comments on commit 87cf54f

Please sign in to comment.