Skip to content

Commit

Permalink
First attempt to move python-sd plugin to use plugin options.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco van Wieringen committed Feb 17, 2015
1 parent d401102 commit 4ff4435
Show file tree
Hide file tree
Showing 4 changed files with 368 additions and 45 deletions.
27 changes: 25 additions & 2 deletions src/plugins/stored/bareos-sd.py.template
Expand Up @@ -22,14 +22,37 @@
from bareossd import *
from bareos_sd_consts import *

def load_bareos_plugin(context):
DebugMessage(context, 100, "load_bareos_plugin called\n");
def load_bareos_plugin(context, plugindef):
DebugMessage(context, 100, "load_bareos_plugin called with param: " + plugindef + "\n");
events = [];
events.append(bsdEventType['bsdEventJobStart']);
events.append(bsdEventType['bsdEventJobEnd']);
RegisterEvents(context, events);
return bRCs['bRC_OK'];

def parse_plugin_definition(context, plugindef):
DebugMessage(context, 100, "parse_plugin_definition called with param: " + plugindef + "\n");
plugin_options = plugindef.split(":");
for current_option in plugin_options:
key,sep,val = current_option.partition("=");
if val == '':
continue;

elif key == 'instance':
continue;

elif key == 'module_path':
continue;

elif key == 'module_name':
continue;

else:
DebugMessage(context, 100, "parse_plugin_definition unknown option " + key + " with value " + val + "\n");
return bRCs['bRC_Error'];

return bRCs['bRC_OK'];

def handle_plugin_event(context, event):
if event == bsdEventType['bsdEventJobStart']:
DebugMessage(context, 100, "bsdEventJobStart event triggered\n");
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/stored/bareos_sd_consts.py
Expand Up @@ -102,5 +102,6 @@
bsdEventVolumeStatus = 17,
bsdEventSetupRecordTranslation = 18,
bsdEventReadRecordTranslation = 19,
bsdEventWriteRecordTranslation = 20
bsdEventWriteRecordTranslation = 20,
bsdEventNewPluginOptions = 21
)

0 comments on commit 4ff4435

Please sign in to comment.