]> git.sur5r.net Git - bacula/bacula/blob - bacula/ReleaseNotes
- Implemented Preben 'Peppe' Guldberg <peppe@wielders.org>
[bacula/bacula] / bacula / ReleaseNotes
1
2           Release Notes for Bacula 1.37.1
3
4   Bacula code: Total files = 398 Total lines = 117,151 (*.h *.c *.in)
5
6
7 Major Changes:
8 - Preliminary Python Event support has been added. See below for
9   configuration.
10   A Python script will be called at particular points or conditions
11   in Bacula called Events. The currently defined Events are called:
12
13   StartJob, EndJob, NewVolume
14
15   Where StartJob is called before the RunBeforeJob, EndJob is called 
16   after RunAfterJob, and NewVolume, is called before all other 
17   "methods" of obtaining a new Volume name, when one is needed.
18
19   The Python script of the same name as the Event name (but with a .py) 
20   is called from the Scripts Directory (a directive defined in the
21   Director resource).  Note, both the Filename, and the name of
22   the function in the file must correspond to the Event name.
23
24   Once the Python script gets control, it can have access to Bacula
25   variables by doing:
26
27      import bacula
28
29   The script is called with one argument, typically called j. This
30   argument *must* be passed unchanged to each bacula function. The
31   format of the call is slightly different for reading Bacula
32   variable and for writing bacula variables. See below.
33
34   Bacula variables can be read with:
35
36      bacula.get(j, "Variable-name")
37
38     where j is the argument passed to the function, and Variable-name
39     is on of the following:
40
41      JobId, Client, Pool, Storage, Catalog, MediaType, NumVols, DirName,
42        Level, Type, Job, JobName, JobStatus
43
44    Bacula varibles can be set using Python keyword arguments:
45
46       bacula.set(jcr=j, VolumeName="xyz")
47
48     The two currently implemented writable "variables" are:
49
50     VolumeName and JobReport
51
52    It is possible to submit a Bacula run command with the following:
53
54      bacula.run(j, "run kernsave client=Matou storage=File")
55
56    this function returns the JobId of the job that was started. If
57    there is an error, the return value is zero.
58
59    Example:
60
61 == File EndJob.py ===
62 import bacula
63
64 def EndJob(j):
65     jobid = bacula.get(j, "JobId")
66     client = bacula.get(j, "Client") 
67     bacula.set(jcr=j, JobReport="EndJob output: JobId=%d Client=%s.\n" % (jobid, client))
68     if (jobid < 5) :
69        startid = bacula.run(j, "run kernsave")
70        print "Python started jobid=", startid
71
72     return 1
73 ====
74
75 == File NewVolume.py ===
76 import bacula
77
78 def NewVolume(j):
79     jobid = bacula.get(j, "JobId")
80     print "JobId=", jobid
81     client = bacula.get(j, "Client") 
82     print "Client=" + client
83     numvol = bacula.get(j, "NumVols");
84     print "NumVols=", numvol
85     bacula.set(jcr=j, JobReport="New Volume set for Job.\n") 
86     bacula.set(jcr=j, VolumeName="TestA-001")
87     return 1
88 ====
89
90
91 New Directives:
92 - Scripts Directory = <directory> name.  Defines the directory from 
93   which Bacula scripts will be called for events. In fact, Bacula
94   appends this name to the standard Python list of search directories,
95   so the script could also be in any of the Python system directories.
96 - In FileSet, you can exclude backing up of hardlinks (if you have
97   a lot, it can be very expensive), by using:
98     HardLinks = no
99   in the Options section. Patch supplied by David R Bosso. Thanks.              
100
101 New Commands:
102 - "python restart" restarts the Python interpreter. Rather brutal, make
103    sure no Python scripts are running. This permits you to change
104    a Python script and get Bacula to use the new script.
105
106 Items to note!!!
107 - You must add --with-python=[DIR] to the configure command line
108   if you want Python support.  Python 2.2 and 2.3 should be automatically
109   detected if in the standard place.
110 - With Python 2.2 version, the link of the Director gets a few linker
111   warnings due to the fact that Python pulls in some old non-secure
112   libraries.
113 - With Python 2.3, there are a few compiler warnings.
114
115 Other Items: