mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-05 10:45:51 +00:00
Remove keyring support
This commit is contained in:
parent
7583be5826
commit
3a3b6ee7ee
5 changed files with 22 additions and 52 deletions
|
|
@ -9,6 +9,16 @@ Package maintainers and users who have to manually update their installation
|
|||
may want to subscribe to `GitHub's tag feed
|
||||
<https://github.com/untitaker/vdirsyncer/tags.atom>`_.
|
||||
|
||||
Version 0.8.0
|
||||
=============
|
||||
|
||||
- Keyring support has been removed, which means that ``password.fetch =
|
||||
["keyring", "example.com", "myuser"]`` doesn't work anymore.
|
||||
|
||||
For existing setups: Use ``password.fetch = ["command", "keyring", "get",
|
||||
"example.com", "myuser"]`` instead, which is more generic. See the
|
||||
documentation for details.
|
||||
|
||||
Version 0.7.5
|
||||
=============
|
||||
|
||||
|
|
|
|||
|
|
@ -38,38 +38,23 @@ You can fetch the username as well::
|
|||
|
||||
Or really any kind of parameter in a storage section.
|
||||
|
||||
System Keyring
|
||||
==============
|
||||
Accessing the system keyring
|
||||
----------------------------
|
||||
|
||||
While the command approach is quite flexible, it is often cumbersome to write a
|
||||
script fetching the system keyring.
|
||||
As shown above, you can use the ``command`` strategy to fetch your credentials
|
||||
from arbitrary sources. A very common usecase is to fetch your password from
|
||||
the system keyring.
|
||||
|
||||
Vdirsyncer can do this for you if you have the keyring_ package installed. How
|
||||
you would obtain this package depends on how you installed vdirsyncer. If you
|
||||
used pip, you can use the following command to also install keyring::
|
||||
The keyring_ Python package contains a command-line utility for fetching
|
||||
passwords from the OS's password store. Installation::
|
||||
|
||||
pip install vdirsyncer[keyring]
|
||||
pip install keyring
|
||||
|
||||
Then you can use::
|
||||
|
||||
[storage foo]
|
||||
type = caldav
|
||||
username = myusername
|
||||
password.fetch = ["keyring", "myservicename", "myusername"]
|
||||
|
||||
|
||||
The password can than be set like this (in a python interpreter)::
|
||||
|
||||
>>> import keyring
|
||||
>>> keyring.set_password("myservicename", "myusername", "password")
|
||||
|
||||
To test if you got it right you can run::
|
||||
|
||||
>>> keyring.get_password("myservicename", "myusername")
|
||||
"password"
|
||||
|
||||
.. _keyring: https://pypi.python.org/pypi/keyring
|
||||
Basic usage::
|
||||
|
||||
password.fetch = ["command", "keyring", "get", "example.com", "foouser"]
|
||||
|
||||
.. _keyring: https://github.com/jaraco/keyring/
|
||||
|
||||
Password Prompt
|
||||
===============
|
||||
|
|
|
|||
1
setup.py
1
setup.py
|
|
@ -50,7 +50,6 @@ setup(
|
|||
'atomicwrites'
|
||||
],
|
||||
extras_require={
|
||||
'keyring': ['keyring'],
|
||||
'remotestorage': ['requests-oauthlib']
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -2,18 +2,6 @@
|
|||
|
||||
from textwrap import dedent
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
class EmptyKeyring(object):
|
||||
def get_password(self, *a, **kw):
|
||||
return None
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def empty_password_storages(monkeypatch):
|
||||
monkeypatch.setattr('vdirsyncer.cli.fetchparams.keyring', EmptyKeyring())
|
||||
|
||||
|
||||
def test_get_password_from_command(tmpdir, runner):
|
||||
runner.write_with_general(dedent('''
|
||||
|
|
|
|||
|
|
@ -10,11 +10,6 @@ SUFFIX = '.fetch'
|
|||
|
||||
logger = log.get(__name__)
|
||||
|
||||
try:
|
||||
import keyring
|
||||
except ImportError:
|
||||
keyring = None
|
||||
|
||||
|
||||
def expand_fetch_params(config):
|
||||
config = dict(config)
|
||||
|
|
@ -72,12 +67,6 @@ def _fetch_value(opts, key):
|
|||
return rv
|
||||
|
||||
|
||||
def _strategy_keyring(username, host):
|
||||
if not keyring:
|
||||
raise RuntimeError('Keyring package not available.')
|
||||
return keyring.get_password(username, host)
|
||||
|
||||
|
||||
def _strategy_command(*command):
|
||||
import subprocess
|
||||
command = (expand_path(command[0]),) + command[1:]
|
||||
|
|
@ -94,7 +83,6 @@ def _strategy_prompt(text):
|
|||
|
||||
|
||||
STRATEGIES = {
|
||||
'keyring': _strategy_keyring,
|
||||
'command': _strategy_command,
|
||||
'prompt': _strategy_prompt,
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue