mirror of
https://github.com/ansible/awx.git
synced 2026-03-07 19:51:08 -03:30
Upgrade keyring to 4.1
This commit is contained in:
@@ -31,7 +31,7 @@ gevent-websocket==0.9.3 (geventwebsocket/*)
|
|||||||
httplib2==0.9 (httplib2/*)
|
httplib2==0.9 (httplib2/*)
|
||||||
importlib==1.0.3 (importlib/*, needed for Python 2.6 support)
|
importlib==1.0.3 (importlib/*, needed for Python 2.6 support)
|
||||||
iso8601==0.1.10 (iso8601/*)
|
iso8601==0.1.10 (iso8601/*)
|
||||||
keyring==4.0 (keyring/*, excluded bin/keyring)
|
keyring==4.1 (keyring/*, excluded bin/keyring)
|
||||||
kombu==3.0.21 (kombu/*)
|
kombu==3.0.21 (kombu/*)
|
||||||
Markdown==2.5.2 (markdown/*, excluded bin/markdown_py)
|
Markdown==2.5.2 (markdown/*, excluded bin/markdown_py)
|
||||||
mock==1.0.1 (mock.py)
|
mock==1.0.1 (mock.py)
|
||||||
|
|||||||
@@ -5,17 +5,27 @@ Keyring implementation support
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
import abc
|
import abc
|
||||||
|
import logging
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import importlib
|
import importlib
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
import pkg_resources
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
from . import errors, util
|
from . import errors, util
|
||||||
from . import backends
|
from . import backends
|
||||||
from .util import properties
|
from .util import properties
|
||||||
from .py27compat import add_metaclass, filter
|
from .py27compat import add_metaclass, filter
|
||||||
|
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class KeyringBackendMeta(abc.ABCMeta):
|
class KeyringBackendMeta(abc.ABCMeta):
|
||||||
"""
|
"""
|
||||||
A metaclass that's both an ABCMeta and a type that keeps a registry of
|
A metaclass that's both an ABCMeta and a type that keeps a registry of
|
||||||
@@ -127,6 +137,38 @@ def _load_backends():
|
|||||||
backends = ('file', 'Gnome', 'Google', 'keyczar', 'kwallet', 'multi',
|
backends = ('file', 'Gnome', 'Google', 'keyczar', 'kwallet', 'multi',
|
||||||
'OS_X', 'pyfs', 'SecretService', 'Windows')
|
'OS_X', 'pyfs', 'SecretService', 'Windows')
|
||||||
list(map(_load_backend, backends))
|
list(map(_load_backend, backends))
|
||||||
|
_load_plugins()
|
||||||
|
|
||||||
|
def _load_plugins():
|
||||||
|
"""
|
||||||
|
Locate all setuptools entry points by the name 'keyring backends'
|
||||||
|
and initialize them.
|
||||||
|
Any third-party library may register an entry point by adding the
|
||||||
|
following to their setup.py::
|
||||||
|
|
||||||
|
entry_points = {
|
||||||
|
'keyring backends': [
|
||||||
|
'plugin_name = mylib.mymodule:initialize_func',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
`plugin_name` can be anything, and is only used to display the name
|
||||||
|
of the plugin at initialization time.
|
||||||
|
|
||||||
|
`initialize_func` is optional, but will be invoked if callable.
|
||||||
|
"""
|
||||||
|
if 'pkg_resources' not in globals():
|
||||||
|
return
|
||||||
|
group = 'keyring backends'
|
||||||
|
entry_points = pkg_resources.iter_entry_points(group=group)
|
||||||
|
for ep in entry_points:
|
||||||
|
try:
|
||||||
|
log.info('Loading %s', ep.name)
|
||||||
|
init_func = ep.load()
|
||||||
|
if callable(init_func):
|
||||||
|
init_func()
|
||||||
|
except Exception:
|
||||||
|
log.exception("Error initializing plugin %s." % ep)
|
||||||
|
|
||||||
@util.once
|
@util.once
|
||||||
def get_all_keyring():
|
def get_all_keyring():
|
||||||
|
|||||||
Reference in New Issue
Block a user