Skip to content

Commit

Permalink
feat(middleware/alert): private method to clear alert sourcec last run
Browse files Browse the repository at this point in the history
Ticket:	#78214
  • Loading branch information
william-gr committed Mar 11, 2019
1 parent 6aab5be commit 0c8f03d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/middlewared/middlewared/plugins/alert.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from collections import defaultdict
import copy
from datetime import datetime
import errno
import os
import traceback

Expand Down Expand Up @@ -463,6 +464,14 @@ async def oneshot_delete(self, job, source, query):

await self.middleware.call("alert.send_alerts")

@private
def alert_source_clear_run(self, name):
alert_source = ALERT_SOURCES.get(name)
if not alert_source:
raise CallError("Alert source {name!r} not found.", errno.ENOENT)

self.alert_source_last_run[alert_source.name] = datetime.min


class AlertServiceService(CRUDService):
class Config:
Expand Down

0 comments on commit 0c8f03d

Please sign in to comment.