Release Notes for Bacula 1.37.1 Bacula code: Total files = 398 Total lines = 117,151 (*.h *.c *.in) Major Changes: - Preliminary Python Event support has been added. See below for configuration. A Python script will be called at particular points or conditions in Bacula called Events. The currently defined Events are called: StartJob, EndJob, NewVolume Where StartJob is called before the RunBeforeJob, EndJob is called after RunAfterJob, and NewVolume, is called before all other "methods" of obtaining a new Volume name, when one is needed. The Python script of the same name as the Event name (but with a .py) is called from the Scripts Directory (a directive defined in the Director resource). Note, both the Filename, and the name of the function in the file must correspond to the Event name. Once the Python script gets control, it can have access to Bacula variables by doing: import bacula The script is called with one argument, typically called j. This argument *must* be passed unchanged to each bacula function. The format of the call is slightly different for reading Bacula variable and for writing bacula variables. See below. Bacula variables can be read with: bacula.get(j, "Variable-name") where j is the argument passed to the function, and Variable-name is on of the following: JobId, Client, Pool, Storage, Catalog, MediaType, NumVols, DirName, Level, Type, Job, JobName, JobStatus Bacula varibles can be set using Python keyword arguments: bacula.set(jcr=j, VolumeName="xyz") The two currently implemented writable "variables" are: VolumeName and JobReport It is possible to submit a Bacula run command with the following: bacula.run(j, "run kernsave client=Matou storage=File") this function returns the JobId of the job that was started. If there is an error, the return value is zero. Example: == File EndJob.py === import bacula def EndJob(j): jobid = bacula.get(j, "JobId") client = bacula.get(j, "Client") bacula.set(jcr=j, JobReport="EndJob output: JobId=%d Client=%s.\n" % (jobid, client)) if (jobid < 5) : startid = bacula.run(j, "run kernsave") print "Python started jobid=", startid return 1 ==== == File NewVolume.py === import bacula def NewVolume(j): jobid = bacula.get(j, "JobId") print "JobId=", jobid client = bacula.get(j, "Client") print "Client=" + client numvol = bacula.get(j, "NumVols"); print "NumVols=", numvol bacula.set(jcr=j, JobReport="New Volume set for Job.\n") bacula.set(jcr=j, VolumeName="TestA-001") return 1 ==== New Directives: - Scripts Directory = name. Defines the directory from which Bacula scripts will be called for events. In fact, Bacula appends this name to the standard Python list of search directories, so the script could also be in any of the Python system directories. - In FileSet, you can exclude backing up of hardlinks (if you have a lot, it can be very expensive), by using: HardLinks = no in the Options section. Patch supplied by David R Bosso. Thanks. New Commands: - "python restart" restarts the Python interpreter. Rather brutal, make sure no Python scripts are running. This permits you to change a Python script and get Bacula to use the new script. Items to note!!! - You must add --with-python=[DIR] to the configure command line if you want Python support. Python 2.2 and 2.3 should be automatically detected if in the standard place. - With Python 2.2 version, the link of the Director gets a few linker warnings due to the fact that Python pulls in some old non-secure libraries. - With Python 2.3, there are a few compiler warnings. Other Items: