some cleanups and bug fixes.

This commit is contained in:
Johannes Findeisen 2013-08-14 20:36:35 +02:00
commit fbf860e573
6 changed files with 25 additions and 17 deletions

View file

@ -2,6 +2,7 @@
This is what job_function needs as parameter for each job to successfully
execute.
"""
from datetime import datetime
@ -11,6 +12,7 @@ def generateId():
yield i
i += 1
class Job:
def __init__(self, service, host):
self.service = service
@ -46,18 +48,17 @@ class Job:
jobInfo = JobInfo(self.host, self.service)
result = self.service._execute(self.host)
jobInfo.set_result(result)
jobInfo.set_successfull(self.service.was_execution_successful())
jobInfo.set_execution_successful(self.service.was_execution_successful())
jobInfo.set_execution_end()
self.handle_threshold(self.service.get_threshold(), self.service.was_execution_successful())
self.jobInfos.append(jobInfo)
except Exception, e:
self.log.d(e)
class JobInfo:
def __init__(self, host, service):
self.id = generateId()
@ -72,6 +73,4 @@ class JobInfo:
self.executionEnd = datetime.now()
def set_execution_successful(self, successful):
self.executionSuccess = successful
self.executionSuccess = successful