From bb510f7b392d2c25a796a7999a9dcbe2f409e420 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 26 Aug 2006 10:26:50 +0000 Subject: [PATCH] Correct Python examples --- docs/manual/python.tex | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/docs/manual/python.tex b/docs/manual/python.tex index fd583f80..83ac5683 100644 --- a/docs/manual/python.tex +++ b/docs/manual/python.tex @@ -408,7 +408,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 @@ -444,17 +444,17 @@ bacula.set_events(BaculaEvents()) # register daemon events desired """ These 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 noop = 1 - def JobInit: + def JobInit(self, job): # Called when the job is first scheduled noop = 1 - def JobRun: + def JobRun(self, job): # Called just before running the job after initializing # This is the point to change most Job parameters. # It is equivalent to the JobRunBefore point. @@ -464,12 +464,16 @@ class JobEvents: # Called when Bacula wants a new Volume name. The Volume # name returned, if any, must be stored in job.VolumeName jobid = job.JobId - client = job.Client - numvol = job.NumVols - volname = "TestA-001" - job.JobReport = "JobId=%d Client=%s NumVols=%d VolumeName=%s" % (jobid, client, numvol,volname) + client = job.Client + numvol = job.NumVols; + print job.CatalogRes + job.JobReport = "JobId=%d Client=%s NumVols=%d" % (jobid, client, numvol) job.JobReport="Python before New Volume set for Job.\n" - job.VolumeName=volname + Vol = "TestA-%d" % numvol + job.JobReport = "Exists=%d TestA-%d" % (job.DoesVolumeExist(Vol), numvol) + job.VolumeName="TestA-%d" % numvol + job.JobReport="Python after New Volume set for Job.\n" + return 1 def VolumePurged(self, job): # Called when a Volume is purged. The Volume name can be referenced -- 2.39.5