Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementation of Python Director Plugin
Implement a plugin that makes it possible to write Director plugins in Python. Stub plugin function is available that loads a python interpreter per plugin instance. Need to link the plugin events to Python methods and allow the Python code to call the plugin code do read and write plugin variables. Fixes #12: Implementation of Python Director Plugin
- Loading branch information
Marco van Wieringen
committed
Feb 17, 2015
1 parent
ef167c7
commit 950e8ba
Showing
7 changed files
with
826 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from bareosdir import * | ||
from bareos_dir_consts import * | ||
|
||
def load_bareos_plugin(context): | ||
DebugMessage(context, 100, "load_bareos_plugin called\n"); | ||
events = []; | ||
events.append(bDirEventType['bDirEventJobStart']); | ||
events.append(bDirEventType['bDirEventJobEnd']); | ||
events.append(bDirEventType['bDirEventJobInit']); | ||
events.append(bDirEventType['bDirEventJobRun']); | ||
RegisterEvents(context, events); | ||
return bRCs['bRC_OK']; | ||
|
||
def handle_plugin_event(context, event): | ||
if event == bDirEventType['bDirEventJobStart']: | ||
DebugMessage(context, 100, "bDirEventJobStart event triggered\n"); | ||
jobname = GetValue(context, brDirVariable['bDirVarJobName']); | ||
DebugMessage(context, 100, "Job " + jobname + " starting\n"); | ||
|
||
elif event == bDirEventType['bDirEventJobEnd']: | ||
DebugMessage(context, 100, "bDirEventJobEnd event triggered\n"); | ||
jobname = GetValue(context, brDirVariable['bDirVarJobName']); | ||
DebugMessage(context, 100, "Job " + jobname + " stopped\n"); | ||
|
||
elif event == bDirEventType['bDirEventJobInit']: | ||
DebugMessage(context, 100, "bDirEventJobInit event triggered\n"); | ||
|
||
elif event == bDirEventType['bDirEventJobRun']: | ||
DebugMessage(context, 100, "bDirEventJobRun event triggered\n"); | ||
|
||
return bRCs['bRC_OK']; | ||
|
Oops, something went wrong.