Exemple #1
0
    def save(self):
#        if not self.pk:
#            #log("created new script '%s'" % self.script_name)
#        else:
#            #log("modified script '%s'" % self.script_name)
        super(Script, self).save()
        dbCommit()
        checkJobSanity()
Exemple #2
0
 def save(self, synchronise=True):
     '''
     synchronise option specifies whether we need to do a dbCommit and
     checkJobSanity()
     '''
     self.user.save()
     super(UserProfile, self).save()
     if synchronise:
         dbCommit()
         checkJobSanity()
Exemple #3
0
 def delete(self):
     # disconnect script from any jobs that refer to it
     for job in self.jobs_pre.all():
         job.pre_script = None
         job.save()
     for job in self.jobs_post.all():
         job.post_script = None
         job.save()
     super(Script, self).delete()
     #log("deleted script '%s'" % self.script_name)
     dbCommit()
     checkJobSanity()
Exemple #4
0
 def save(self, checkSanity=True):
     # convert unicode-specified datetime objects to python datetime ones, so that they get stored correctly in the database -
     # otherwise, if unicode is specified and seconds are ommited like "2008-05-05 12:45", then it is stored in the sqlite db
     # as such, and causes an index error since django expects there to be seconds when parsing it for conversion back into a
     # datetime object when queried.
     if type(self.expiry) == type(u''):
         self.expiry = datetime.datetime(*map(int, self.expiry.replace("-", " ").replace(":", " ").split()))
     if type(self.run_at) == type(u''):
         self.run_at = datetime.datetime(*map(int, self.run_at.replace("-", " ").replace(":", " ").split()))
     # purge microsecond value from datetime fields that get directly printed to the web gui
     if type(self.last_run_time) == type(datetime.datetime.now()):
         self.last_run_time = self.last_run_time.replace(microsecond=0)
     if type(self.timeLastSeenSane) == type(datetime.datetime.now()):
         self.timeLastSeenSane = self.timeLastSeenSane.replace(microsecond=0)
     super(Job, self).save()
     dbCommit()
     if checkSanity:
         checkJobSanity()
Exemple #5
0
 def save(self):
     super(xGroup, self).save()
     # if alertable is false, remove group from any jobs that use group as an
     # alert target.
     modded_jobs = []
     if not self.alertable:
         for job in self.jobAlertSuccess.all():
             job.alert_groups_on_success.remove(self)
             modded_jobs.append(job.job_name)
         for job in self.jobAlertFail.all():
             job.alert_groups_on_fail.remove(self)
             if job.job_name not in modded_jobs:
                 modded_jobs.append(job.job_name)
     if modded_jobs:
         log("removed Group '%s' as an alert target from the " \
             "following %s job(s): %s" % (self.group_name, \
             len(modded_jobs), "'" + "', '".join(modded_jobs) + "'"))
     dbCommit()
     checkJobSanity()
Exemple #6
0
 def delete(self):
     super(Job, self).delete()
     #log("deleted job '%s'" % self.job_name)
     dbCommit()
     checkJobSanity()
Exemple #7
0
 def save(self):
     #log("modified system-wide configuration")
     super(Configuration, self).save()
     dbCommit()
Exemple #8
0
 def delete(self):
     super(xGroup, self).delete()
     #log("deleted group: %s" % self.group_name)
     dbCommit()
     checkJobSanity()