config.py

changeset 3
4cad934aa9ce
parent 2
e343594c0014
child 4
d72c4844e791
equal deleted inserted replaced
2:e343594c0014 3:4cad934aa9ce
21 # borg 21 # borg
22 'borg': { 22 'borg': {
23 'executable': 'borg', 23 'executable': 'borg',
24 'common_parameters': [], 24 'common_parameters': [],
25 'create_parameters': [], 25 'create_parameters': [],
26 'prune_parameters': [],
26 } 27 }
27 } 28 }
28 29
29 30
30 # 31 #
126 else: 127 else:
127 def check_and_set(cfg, field, loc, defa, fn): 128 def check_and_set(cfg, field, loc, defa, fn):
128 cfg[field]=fn(cfg, field, field, loc, defa[field]) 129 cfg[field]=fn(cfg, field, field, loc, defa[field])
129 return cfg 130 return cfg
130 131
132 def check_parameters(cmd):
133 settings['borg']=check_and_set(settings['borg'], cmd+'_parameters',
134 'borg', defaults['borg'],
135 check_list_of_dicts)
136
131 settings['borg']=check_and_set(settings['borg'], 'executable', 'borg', 137 settings['borg']=check_and_set(settings['borg'], 'executable', 'borg',
132 defaults['borg'], check_string) 138 defaults['borg'], check_string)
133 139
134 settings['borg']=check_and_set(settings['borg'], 'common_parameters', 'borg', 140 check_parameters('common')
135 defaults['borg'], check_list_of_dicts) 141 check_parameters('create')
142 check_parameters('prune')
136 143
137 settings['borg']=check_and_set(settings['borg'], 'create_parameters', 'borg',
138 defaults['borg'], check_list_of_dicts)
139 144

mercurial