Skip to content

Commit

Permalink
alerts should not be created if agent in maintenance mode fixes amida…
Browse files Browse the repository at this point in the history
  • Loading branch information
wh1te909 committed Jun 11, 2024
1 parent 29640a9 commit 7c9f250
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions api/tacticalrmm/alerts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ def resolve(self) -> None:
def create_or_return_availability_alert(
cls, agent: Agent, skip_create: bool = False
) -> Optional[Alert]:
if agent.maintenance_mode:
return None

if not cls.objects.filter(
agent=agent, alert_type=AlertType.AVAILABILITY, resolved=False
).exists():
Expand Down Expand Up @@ -166,6 +169,9 @@ def create_or_return_check_alert(
alert_severity: Optional[str] = None,
skip_create: bool = False,
) -> "Optional[Alert]":
if agent.maintenance_mode:
return None

# need to pass agent if the check is a policy
if not cls.objects.filter(
assigned_check=check,
Expand Down Expand Up @@ -230,6 +236,9 @@ def create_or_return_task_alert(
agent: "Agent",
skip_create: bool = False,
) -> "Optional[Alert]":
if agent.maintenance_mode:
return None

if not cls.objects.filter(
assigned_task=task,
agent=agent,
Expand Down

0 comments on commit 7c9f250

Please sign in to comment.