mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +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):
|
def get_storage_args(self, storage_name, pair_name=None):
|
||||||
try:
|
try:
|
||||||
return expand_fetch_params(self.storages[storage_name])
|
args = self.storages[storage_name]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pair_pref = 'Pair {}: '.format(pair_name) if pair_name else ''
|
pair_pref = 'Pair {}: '.format(pair_name) if pair_name else ''
|
||||||
raise CliError(
|
raise CliError(
|
||||||
|
|
@ -194,6 +194,8 @@ class Config(object):
|
||||||
'These are the configured storages: {}'
|
'These are the configured storages: {}'
|
||||||
.format(pair_pref, storage_name, list(self.storages))
|
.format(pair_pref, storage_name, list(self.storages))
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
return expand_fetch_params(args)
|
||||||
|
|
||||||
def get_pair(self, pair_name):
|
def get_pair(self, pair_name):
|
||||||
return PairConfig(self, pair_name, *self.pairs[pair_name])
|
return PairConfig(self, pair_name, *self.pairs[pair_name])
|
||||||
|
|
|
||||||
|
|
@ -51,10 +51,19 @@ def _fetch_value(opts, key):
|
||||||
return rv
|
return rv
|
||||||
|
|
||||||
strategy = opts[0]
|
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.'
|
logger.debug('Fetching value for {} with {} strategy.'
|
||||||
.format(key, strategy))
|
.format(key, strategy))
|
||||||
try:
|
try:
|
||||||
rv = STRATEGIES[strategy](*opts[1:])
|
rv = strategy_fn(*opts[1:])
|
||||||
except (click.Abort, KeyboardInterrupt) as e:
|
except (click.Abort, KeyboardInterrupt) as e:
|
||||||
password_cache[cache_key] = e
|
password_cache[cache_key] = e
|
||||||
raise
|
raise
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue