Skip to content
Snippets Groups Projects
Commit 32070c0b authored by Felix Jung's avatar Felix Jung Committed by Henrik tom Wörden
Browse files

fixed system keyring authentification issue

- Removed superfluous call to `_call_keyring`
- Replaced deprecated `imp` module
parent 945a1f35
No related branches found
No related tags found
1 merge request!36RELEASE: 0.6.1
Pipeline #16925 passed
...@@ -28,7 +28,7 @@ retrieve the password. ...@@ -28,7 +28,7 @@ retrieve the password.
""" """
import sys import sys
import imp import importlib
from getpass import getpass from getpass import getpass
from caosdb.exceptions import ConfigurationError from caosdb.exceptions import ConfigurationError
from .external_credentials_provider import ExternalCredentialsProvider from .external_credentials_provider import ExternalCredentialsProvider
...@@ -52,17 +52,13 @@ def get_authentication_provider(): ...@@ -52,17 +52,13 @@ def get_authentication_provider():
def _get_external_keyring(): def _get_external_keyring():
try: try:
fil, pathname, desc = imp.find_module("keyring", sys.path[1:]) return importlib.import_module("keyring")
module = imp.load_module("external_keyring", fil, pathname, desc)
return module
except ImportError: except ImportError:
raise RuntimeError( raise RuntimeError(
"The keyring password method requires installation of the" "The keyring password method requires installation of the"
"keyring python package. On linux with python < 3.5, " "keyring python package. On linux with python < 3.5, "
"this requires the installation of dbus-python as a " "this requires the installation of dbus-python as a "
"system package.") "system package.")
finally:
fil.close()
def _call_keyring(**config): def _call_keyring(**config):
...@@ -74,7 +70,6 @@ def _call_keyring(**config): ...@@ -74,7 +70,6 @@ def _call_keyring(**config):
url = config.get("url") url = config.get("url")
username = config.get("username") username = config.get("username")
app = "caosdb — {}".format(url) app = "caosdb — {}".format(url)
password = _call_keyring(app=app, username=username)
external_keyring = _get_external_keyring() external_keyring = _get_external_keyring()
password = external_keyring.get_password(app, username) password = external_keyring.get_password(app, username)
if password is None: if password is None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment