added some logic for jobsprocessing, magically somehow not working...

This commit is contained in:
Rafael.Timmerberg 2013-05-29 01:03:01 +02:00
commit f7c5cd65cc
5 changed files with 65 additions and 37 deletions

View file

@ -3,7 +3,7 @@ This is what job_function needs as parameter for each job to successfully
execute.
"""
import subprocess
from command import Command
class JobInfo:
@ -14,6 +14,7 @@ class JobInfo:
self.threshold = threshold
self.parent = parent
self.name = hostgroupname + "_" + service.name
self.jobs = []
def __str__(self):
return self.name
@ -21,8 +22,21 @@ class JobInfo:
def setLogger(self, log):
self.log = log
def appendJob(self, job):
self.jobs.append(job)
def getNextExecutionTime(self):
nextExecution = None
for job in self.jobs:
jobExec = job.trigger.get_next_fire_time()
if nextExecution is None or nextExecution > jobExec:
nextExecution = jobExec
return nextExecution
def handleCall(self):
#p = subprocess.Popen("df -h", stdout=subprocess.PIPE, shell=True)
#(output, err) = p.communicate()
#print output
pass
print "calling command " + str(service.command)
cmd = Command(service.command)
self.log.d("executing command: " + str(command))
cmd.call()
return cmd