diff --git a/vdirsyncer/cli/config.py b/vdirsyncer/cli/config.py index 5f0252c..63dd071 100644 --- a/vdirsyncer/cli/config.py +++ b/vdirsyncer/cli/config.py @@ -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]) diff --git a/vdirsyncer/cli/fetchparams.py b/vdirsyncer/cli/fetchparams.py index b177b4b..5fe3920 100644 --- a/vdirsyncer/cli/fetchparams.py +++ b/vdirsyncer/cli/fetchparams.py @@ -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