1#!/usr/bin/env python
2
3import sys
4import os.path
5
6libdirs = ["/usr/lib64/bareos/plugins/", "/usr/lib/bareos/plugins/"]
7sys.path.extend([l for l in libdirs if os.path.isdir(l)])
8
9# Provided by the Bareos FD Python plugin interface
10from bareos_fd_consts import bRCs
11
12# This module contains the wrapper functions called by the Bareos-FD, the
13# functions call the corresponding
14# methods from your plugin class
15import BareosFdWrapper
16from BareosFdWrapper import (
17    parse_plugin_definition,
18    handle_plugin_event,
19    start_backup_file,
20    end_backup_file,
21    start_restore_file,
22    end_restore_file,
23    restore_object_data,
24    plugin_io,
25    create_file,
26    set_file_attributes,
27    check_file,
28    get_acl,
29    set_acl,
30    get_xattr,
31    set_xattr,
32    handle_backup_file,
33)
34
35# This module contains the used plugin class
36import BareosFdPluginOvirt
37
38
39def load_bareos_plugin(context, plugindef):
40    """
41    This function is called by the Bareos-FD to load the plugin
42    We use it to intantiate the plugin class
43    """
44    # BareosFdWrapper.bareos_fd_plugin_object is the module attribute that holds the plugin class object
45    BareosFdWrapper.bareos_fd_plugin_object = BareosFdPluginOvirt.BareosFdPluginOvirt(
46        context, plugindef
47    )
48
49    return bRCs["bRC_OK"]
50
51
52# the rest is done in the Plugin module
53