]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/examples/python/SDStartUp.py
Remove jobq.c constraint that read and write SD must be
[bacula/bacula] / bacula / examples / python / SDStartUp.py
index 480f7fb2875d02142fc2fd81ec20f19f2bfe4217..1f08beda4ca6cd17443106b4f0489b9f755a66e2 100644 (file)
@@ -6,7 +6,7 @@ import sys, bacula
 
 # This is the list of Bacula daemon events that you
 #  can receive.
-class BaculaEvents:
+class BaculaEvents(object):
   def __init__(self):
      # Called here when a new Bacula Events class is
      #  is created. Normally not used 
@@ -23,21 +23,21 @@ class BaculaEvents:
      job.set_events(events)       # register events desired
      sys.stderr = events          # send error output to Bacula
      sys.stdout = events          # send stdout to Bacula
-     jobid = job.get("JobId")
-     client = job.get("Client")
-     job.set(JobReport="Python SD StartJob: JobId=%d Client=%s \n" % (jobid,client))
+     jobid = job.JobId
+     client = job.Client
+     job.JobReport="Python SD JobStart: JobId=%d Client=%s \n" % (jobid,client)
      return 1
 
   # Bacula Job is going to terminate
   def JobEnd(self, job):    
-     jobid = job.get("JobId")
-     client = job.get("Client") 
-     job.set(JobReport="Python SD EndJob output: JobId=%d Client=%s.\n" % (jobid, client))
-     print "Python SD JobEnd\n"  
-     return 1
+     jobid = job.JobId
+     client = job.Client 
+     job.JobReport="Python SD JobEnd output: JobId=%d Client=%s.\n" % (jobid, client)
+#    print "Python SD JobEnd\n"  
+     
 
   # Called here when the Bacula daemon is going to exit
-  def Exit(self, job):
+  def Exit(self):
       noop = 1
      
 bacula.set_events(BaculaEvents()) # register daemon events desired
@@ -45,7 +45,7 @@ bacula.set_events(BaculaEvents()) # register daemon events desired
 """
   There are the Job events that you can receive.
 """
-class JobEvents:
+class JobEvents(object):
   def __init__(self):
      # Called here when you instantiate the Job. Not
      # normally used
@@ -54,4 +54,3 @@ class JobEvents:
   # Pass output back to Bacula
   def write(self, text):
      self.job.write(text)
-