3 # |
3 # |
4 |
4 |
5 import config |
5 import config |
6 import logging |
6 import logging |
7 import time |
7 import time |
|
8 import keyring |
8 from instance import BorgInstance |
9 from instance import BorgInstance |
9 from queue import Queue |
10 from queue import Queue |
10 from threading import Thread, Lock, Timer |
11 from threading import Thread, Lock, Timer |
11 |
12 |
12 loglevel_translation={ |
13 loglevel_translation={ |
69 |
70 |
70 self.prune_parameters=config.check_list_of_dicts(cfg, 'prune_parameters', |
71 self.prune_parameters=config.check_list_of_dicts(cfg, 'prune_parameters', |
71 'Prune parameters', self.loc, |
72 'Prune parameters', self.loc, |
72 default=[]) |
73 default=[]) |
73 |
74 |
|
75 keychain_account=config.check_string(cfg, 'keychain_account', |
|
76 'Keychain account', self.loc, |
|
77 default='') |
|
78 |
|
79 if keychain_account and keychain_account!='': |
|
80 pw=keyring.get_password("borg-backup", keychain_account) |
|
81 self.__password=pw |
|
82 else: |
|
83 self.__password=None |
74 |
84 |
75 def __init__(self, identifier, cfg): |
85 def __init__(self, identifier, cfg): |
76 self.identifier=identifier |
86 self.identifier=identifier |
77 |
87 |
78 self.__decode_config(cfg) |
88 self.__decode_config(cfg) |
210 if callback: |
220 if callback: |
211 callback(self, status) |
221 callback(self, status) |
212 |
222 |
213 def __do_launch(self, queue, op, archive_or_repository, *args): |
223 def __do_launch(self, queue, op, archive_or_repository, *args): |
214 inst=BorgInstance(op['operation'], archive_or_repository, *args) |
224 inst=BorgInstance(op['operation'], archive_or_repository, *args) |
215 inst.launch() |
225 inst.launch(password=self.__password) |
216 |
226 |
217 t_log=Thread(target=self.__log_listener) |
227 t_log=Thread(target=self.__log_listener) |
218 t_log.daemon=True |
228 t_log.daemon=True |
219 |
229 |
220 t_res=Thread(target=self.__result_listener) |
230 t_res=Thread(target=self.__result_listener) |