From 51f9c2d6d173d1903c8746c034d9a1bad13c6517 Mon Sep 17 00:00:00 2001 From: Johannes Findeisen Date: Sat, 9 Nov 2013 04:08:03 +0100 Subject: [PATCH] reorganized tasks to subdirs like services --- examples/dev.json | 8 +++--- examples/minimal.json | 2 +- examples/stress.json | 2 +- linspector/tasks/alert/__init__.py | 0 linspector/tasks/{ => alert}/jabber.py | 0 linspector/tasks/{ => alert}/mail.py | 0 linspector/tasks/{ => alert}/sms.py | 0 linspector/tasks/{ => alert}/tweet.py | 0 linspector/tasks/storage/__init__.py | 1 + linspector/tasks/{ => storage}/mariadb.py | 0 linspector/tasks/{ => storage}/mongodb.py | 0 linspector/tasks/syslog.py | 35 ----------------------- 12 files changed, 7 insertions(+), 41 deletions(-) create mode 100644 linspector/tasks/alert/__init__.py rename linspector/tasks/{ => alert}/jabber.py (100%) rename linspector/tasks/{ => alert}/mail.py (100%) rename linspector/tasks/{ => alert}/sms.py (100%) rename linspector/tasks/{ => alert}/tweet.py (100%) create mode 100644 linspector/tasks/storage/__init__.py rename linspector/tasks/{ => storage}/mariadb.py (100%) rename linspector/tasks/{ => storage}/mongodb.py (100%) delete mode 100644 linspector/tasks/syslog.py diff --git a/examples/dev.json b/examples/dev.json index 275b175..0d9724f 100644 --- a/examples/dev.json +++ b/examples/dev.json @@ -4,7 +4,7 @@ "name": "root", "tasks": [ { - "class": "mail", + "class": "alert/mail", "type": "error", "args": { "host": "localhost", "port": 25, @@ -15,7 +15,7 @@ } }, { - "class": "mail", + "class": "alert/mail", "type": "warning", "args": { "host": "localhost", "sender": "linspector@linspector.org", @@ -23,7 +23,7 @@ } }, { - "class": "mail", + "class": "alert/mail", "type": "ok", "args": { "sender": "linspector@linspector.org", "rcpt": "warning@linspector.org" } @@ -34,7 +34,7 @@ "name": "hannes", "tasks": [ { - "class": "mail", + "class": "alert/mail", "type": "ok", "args": { "rcpt": "warning@linspector.org" } } diff --git a/examples/minimal.json b/examples/minimal.json index 8026ed7..34617a7 100644 --- a/examples/minimal.json +++ b/examples/minimal.json @@ -12,7 +12,7 @@ "root":{ "name": "root", "tasks": [ - { "class":"mail", "type": "error", "args": { "_rcpt": "hanez@linspector.org" }} + { "class":"alert/mail", "type": "error", "args": { "_rcpt": "hanez@linspector.org" }} ] } }, diff --git a/examples/stress.json b/examples/stress.json index 03feee0..11535c5 100644 --- a/examples/stress.json +++ b/examples/stress.json @@ -12,7 +12,7 @@ "hanez":{ "name": "admin", "tasks": [ - { "class":"mail", "type": "error", "args": { "_rcpt": "hanez@linspector.org" }} + { "class":"alert/mail", "type": "error", "args": { "_rcpt": "hanez@linspector.org" }} ] } }, diff --git a/linspector/tasks/alert/__init__.py b/linspector/tasks/alert/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/linspector/tasks/jabber.py b/linspector/tasks/alert/jabber.py similarity index 100% rename from linspector/tasks/jabber.py rename to linspector/tasks/alert/jabber.py diff --git a/linspector/tasks/mail.py b/linspector/tasks/alert/mail.py similarity index 100% rename from linspector/tasks/mail.py rename to linspector/tasks/alert/mail.py diff --git a/linspector/tasks/sms.py b/linspector/tasks/alert/sms.py similarity index 100% rename from linspector/tasks/sms.py rename to linspector/tasks/alert/sms.py diff --git a/linspector/tasks/tweet.py b/linspector/tasks/alert/tweet.py similarity index 100% rename from linspector/tasks/tweet.py rename to linspector/tasks/alert/tweet.py diff --git a/linspector/tasks/storage/__init__.py b/linspector/tasks/storage/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/linspector/tasks/storage/__init__.py @@ -0,0 +1 @@ + diff --git a/linspector/tasks/mariadb.py b/linspector/tasks/storage/mariadb.py similarity index 100% rename from linspector/tasks/mariadb.py rename to linspector/tasks/storage/mariadb.py diff --git a/linspector/tasks/mongodb.py b/linspector/tasks/storage/mongodb.py similarity index 100% rename from linspector/tasks/mongodb.py rename to linspector/tasks/storage/mongodb.py diff --git a/linspector/tasks/syslog.py b/linspector/tasks/syslog.py deleted file mode 100644 index 1aabc13..0000000 --- a/linspector/tasks/syslog.py +++ /dev/null @@ -1,35 +0,0 @@ -""" -The syslog task - -Copyright (c) 2011-2013 by Johannes Findeisen and Rafael Timmerberg - -This file is part of Linspector (http://linspector.org). - -Linspector is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as -published by the Free Software Foundation, either version 3 of the -License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see . -""" - -from logging import getLogger - -from linspector.tasks.task import Task - -logger = getLogger(__name__) - - -class SyslogTask(Task): - def __init__(self, **kwargs): - pass - - -def create(kwargs): - return SyslogTask(**kwargs) \ No newline at end of file