getting there...

This commit is contained in:
brent s 2019-06-02 11:38:50 -04:00
parent 419f266f0f
commit 118e1355bc
2 changed files with 4 additions and 2 deletions

View File

@ -273,6 +273,7 @@ class Backup(object):
import importlib
_orig_path = sys.path
for plugin in repo['plugins']:
logging.debug('Initializing plugin: {0}'.format(plugin))
if repo['plugins'][plugin]['path']:
sys.path.insert(1, os.path.abspath(os.path.expanduser(repo['plugins'][plugin]['path'])))
optools_tmpmod = importlib.import_module(plugin, package = None)
@ -283,6 +284,7 @@ class Backup(object):
del(sys.modules[plugin])
del(optools_tmpmod)
sys.path = _orig_path
logging.debug('Finished plugin: {0}'.format(plugin))
# This is where we actually do the thing.
_cmd = [self.borgbin,
'--log-json',

View File

@ -41,8 +41,8 @@
<prep inline="0">/usr/local/bin/someprep.sh</prep>
<!-- Plugins are direct Python modules, and are alternatives to prep items.
They must:
- be in the Python's path environment (or a path must be provided, either absolute or relative to
execution)
- be in the Python's path environment (or a path must be provided) either absolute or relative to
*execution*, not the script's placement in the filesystem)
- contain a class called <module>.Backup() (which will execute all tasks on initialization)
See plugins/ directory for examples and below for example of invocation. -->
<plugins>