From 8103e33299c0be7485ebe9086b22c33196d6e74c Mon Sep 17 00:00:00 2001 From: Johannes Findeisen Date: Thu, 19 Sep 2013 21:12:03 +0200 Subject: [PATCH] just some cleanups and ideas in hanez.json --- examples/hanez.json | 12 ++++++++++-- lib/tasks/jabber.py | 2 +- lib/tasks/sms.py | 2 +- lib/tasks/task.py | 10 ---------- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/examples/hanez.json b/examples/hanez.json index b87f047..7efb11f 100644 --- a/examples/hanez.json +++ b/examples/hanez.json @@ -19,7 +19,7 @@ "class": "tcpconnect", "args": { "port": 80 }, "periods": ["always"], - "threshold": 10 + "threshold": 2 } ] } @@ -34,6 +34,14 @@ "max_logfile_size": 1024000, "max_logfile_count": 4, "max_worker_threads": 8, - "members":[ "root" ] + "members":[ "root" ], + "tasks": { + "jabber":{ + "server": "systemchaos.org", + "port": 5222, + "user": "linspector", + "password": "hallo_welt" + } + } } } \ No newline at end of file diff --git a/lib/tasks/jabber.py b/lib/tasks/jabber.py index 8c84720..2699d4a 100644 --- a/lib/tasks/jabber.py +++ b/lib/tasks/jabber.py @@ -22,7 +22,7 @@ class JabberTask(Task): client.connect(server=('systemchaos.org', 5222)) client.auth('linspector', 'PASSWORD', 'alert') client.sendInitPresence() - message = xmpp.Message('hanez@systemchaos.org', msg) + message = xmpp.Message(self.recipient, msg) message.setAttr('type', 'chat') client.send(message) diff --git a/lib/tasks/sms.py b/lib/tasks/sms.py index 3a45dfd..203ab4d 100644 --- a/lib/tasks/sms.py +++ b/lib/tasks/sms.py @@ -14,7 +14,7 @@ class SmsTask(Task): self.set_task_type(kwargs["type"]) self.recipient = kwargs["args"]["rcpt"] - def execute_task(self, msg): + def execute(self, msg): pass diff --git a/lib/tasks/task.py b/lib/tasks/task.py index e8b113f..cf88f03 100644 --- a/lib/tasks/task.py +++ b/lib/tasks/task.py @@ -4,21 +4,11 @@ The task class. class Task: - """ - Base class for all built-in Tasks. - """ - def set_task_type(self, taskType): self._taskType = taskType def get_task_type(self): - """ - :return: the type set by set_type_task - """ return self._taskType - def some_other_irrelevant_methods(self): - pass - def execute(self, msg): pass \ No newline at end of file