1#!/usr/bin/env python 2# BAREOS - Backup Archiving REcovery Open Sourced 3# 4# Copyright (C) 2018-2020 Bareos GmbH & Co. KG 5# 6# This program is Free Software; you can redistribute it and/or 7# modify it under the terms of version three of the GNU Affero General Public 8# License as published by the Free Software Foundation and included 9# in the file LICENSE. 10# 11# This program is distributed in the hope that it will be useful, but 12# WITHOUT ANY WARRANTY; without even the implied warranty of 13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14# Affero General Public License for more details. 15# 16# You should have received a copy of the GNU Affero General Public License 17# along with this program; if not, write to the Free Software 18# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 19# 02110-1301, USA. 20 21 22import sys 23import os.path 24 25libdirs = ["/usr/lib64/bareos/plugins/", "/usr/lib/bareos/plugins/"] 26sys.path.extend([l for l in libdirs if os.path.isdir(l)]) 27 28# Provided by the Bareos FD Python plugin interface 29from bareosfd import * 30 31# This module contains the wrapper functions called by the Bareos-FD, the 32# functions call the corresponding 33# methods from your plugin class 34import BareosFdWrapper 35from BareosFdWrapper import ( 36 parse_plugin_definition, 37 handle_plugin_event, 38 start_backup_file, 39 end_backup_file, 40 start_restore_file, 41 end_restore_file, 42 restore_object_data, 43 plugin_io, 44 create_file, 45 set_file_attributes, 46 check_file, 47 get_acl, 48 set_acl, 49 get_xattr, 50 set_xattr, 51 handle_backup_file, 52) 53 54# This module contains the used plugin class 55import BareosFdPluginOvirt 56 57 58def load_bareos_plugin(plugindef): 59 """ 60 This function is called by the Bareos-FD to load the plugin 61 We use it to intantiate the plugin class 62 """ 63 # BareosFdWrapper.bareos_fd_plugin_object is the module attribute that holds the plugin class object 64 BareosFdWrapper.bareos_fd_plugin_object = BareosFdPluginOvirt.BareosFdPluginOvirt( 65 plugindef 66 ) 67 68 return bRC_OK 69 70 71# the rest is done in the Plugin module 72