From 5785340a55bbb661a19cfca86211e2a733c506ad Mon Sep 17 00:00:00 2001 From: Johannes Findeisen Date: Fri, 22 Nov 2013 19:32:05 +0100 Subject: [PATCH] fixed mongodb task; writes just a timestamp and the response message for now --- linspector/tasks/storage/mongodb.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/linspector/tasks/storage/mongodb.py b/linspector/tasks/storage/mongodb.py index 2ede866..f168b3c 100644 --- a/linspector/tasks/storage/mongodb.py +++ b/linspector/tasks/storage/mongodb.py @@ -19,6 +19,7 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . """ +import datetime from logging import getLogger from pymongo import MongoClient @@ -50,13 +51,14 @@ class MongodbTask(Task): if "port" in args: self.port = args["port"] - #self.mongo_client = MongoClient(self.host, self.port) - #self.mongo_db = self.mongo_client[self.database] - #self.mongo_db_collection = self.mongo_db[self.collection] + self.mongo_client = MongoClient(self.host, self.port) + self.mongo_db = self.mongo_client[self.database] + self.mongo_db_collection = self.mongo_db[self.collection] def execute(self, job_information): - #self.mongo_db_collection.insert(job_information.__dict__) - pass + data = {"timestamp": str(datetime.datetime.now()), + "msg": job_information.get_response_message()} + self.mongo_db_collection.insert(data) def create(kwargs):