|
@@ -485,7 +485,7 @@ def config():
|
|
|
if hasattr(config, '_handle'):
|
|
|
return config._handle
|
|
|
|
|
|
- with pushd('etc/backup.d'):
|
|
|
+ with pushd(config._root):
|
|
|
with open("backup.yml") as f:
|
|
|
config._handle = yaml.load(f, Loader=yaml.SafeLoader)
|
|
|
|
|
@@ -497,7 +497,7 @@ def sources():
|
|
|
return sources._handle
|
|
|
|
|
|
sources._handle = {}
|
|
|
- with pushd('etc/backup.d'):
|
|
|
+ with pushd(config._root):
|
|
|
for source in config()['sources']:
|
|
|
source = os.path.realpath(source)
|
|
|
for path in glob('{}/*.yml'.format(source)) + \
|
|
@@ -520,6 +520,11 @@ def sources():
|
|
|
|
|
|
|
|
|
def main(args):
|
|
|
+ config._root = args[0] if len(args) else '/etc/backup.d'
|
|
|
+ if not os.path.exists(config._root):
|
|
|
+ raise BackupException(
|
|
|
+ 'Configuration files missing from {}'.format(config._root))
|
|
|
+
|
|
|
if 'engine' in config():
|
|
|
engine = config()["engine"]
|
|
|
if engine not in ("rdiff-backup"):
|