mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-31 09:55:55 +00:00
parent
6c7b6f47b1
commit
d30b4752db
2 changed files with 13 additions and 2 deletions
|
|
@ -186,7 +186,7 @@ class Config(object):
|
|||
|
||||
def get_storage_args(self, storage_name, pair_name=None):
|
||||
try:
|
||||
return expand_fetch_params(self.storages[storage_name])
|
||||
args = self.storages[storage_name]
|
||||
except KeyError:
|
||||
pair_pref = 'Pair {}: '.format(pair_name) if pair_name else ''
|
||||
raise CliError(
|
||||
|
|
@ -194,6 +194,8 @@ class Config(object):
|
|||
'These are the configured storages: {}'
|
||||
.format(pair_pref, storage_name, list(self.storages))
|
||||
)
|
||||
else:
|
||||
return expand_fetch_params(args)
|
||||
|
||||
def get_pair(self, pair_name):
|
||||
return PairConfig(self, pair_name, *self.pairs[pair_name])
|
||||
|
|
|
|||
|
|
@ -51,10 +51,19 @@ def _fetch_value(opts, key):
|
|||
return rv
|
||||
|
||||
strategy = opts[0]
|
||||
try:
|
||||
strategy_fn = STRATEGIES[strategy]
|
||||
except KeyError:
|
||||
if strategy == 'keyring':
|
||||
raise exceptions.UserError(
|
||||
'Fetching passwords via keyring is deprecated. See the '
|
||||
'changelog for migration paths.')
|
||||
raise exceptions.UserError('Unknown strategy: {}'.format(strategy))
|
||||
|
||||
logger.debug('Fetching value for {} with {} strategy.'
|
||||
.format(key, strategy))
|
||||
try:
|
||||
rv = STRATEGIES[strategy](*opts[1:])
|
||||
rv = strategy_fn(*opts[1:])
|
||||
except (click.Abort, KeyboardInterrupt) as e:
|
||||
password_cache[cache_key] = e
|
||||
raise
|
||||
|
|
|
|||
Loading…
Reference in a new issue