Skip to content

Commit

Permalink
Remove warning about logging in to ESGF (#2326)
Browse files Browse the repository at this point in the history
  • Loading branch information
bouweandela authored Feb 7, 2024
1 parent 6f30fa6 commit 6f879cf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 64 deletions.
4 changes: 2 additions & 2 deletions doc/quickstart/configure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,8 @@ corresponding command line arguments ``--search_esgf=when_missing`` or
tool by pressing the ``Ctrl`` and ``C`` keys on your keyboard simultaneously
several times, edit the recipe so it contains fewer datasets and try again.

For downloading some files (e.g. those produced by the CORDEX project),
you need to log in to be able to download the data.
For downloading some files, you may need to log in to be able to download the
data.

See the
`ESGF user guide <https://esgf.github.io/esgf-user-support/user_guide.html>`_
Expand Down
62 changes: 0 additions & 62 deletions esmvalcore/config/_esgf_pyclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import logging
import os
import stat
import textwrap
from functools import lru_cache
from pathlib import Path
from types import ModuleType
Expand All @@ -30,59 +29,6 @@

CONFIG_FILE = Path.home() / '.esmvaltool' / 'esgf-pyclient.yml'

INSTRUCTIONS = textwrap.dedent("""
ESGF credentials missing, only data that is accessible without
logging in will be available.
See https://esgf.github.io/esgf-user-support/user_guide.html
for instructions on how to create an account if you do not have
one yet.
Next, configure your system so esmvaltool can use your
credentials. This can be done using the keyring package, or
you can just enter them in {cfg_file}.
keyring
=======
First install the keyring package (requires a supported
backend, see https://pypi.org/project/keyring/):
$ pip install keyring
Next, set your username and password by running the commands:
$ keyring set ESGF hostname
$ keyring set ESGF username
$ keyring set ESGF password
To check that you entered your credentials correctly, run:
$ keyring get ESGF hostname
$ keyring get ESGF username
$ keyring get ESGF password
configuration file
==================
You can store the hostname, username, and password or your OpenID
account in a plain text in the file {cfg_file} like this:
logon:
hostname: "your-hostname"
username: "your-username"
password: "your-password"
or your can configure an interactive log in:
logon:
interactive: true
Note that storing your password in plain text in the configuration
file is less secure. On shared systems, make sure the permissions
of the file are set so only you can read it, i.e.
$ ls -l {cfg_file}
shows permissions -rw-------.
""".format(cfg_file=CONFIG_FILE))


def get_keyring_credentials():
"""Load credentials from keyring."""
Expand Down Expand Up @@ -172,14 +118,6 @@ def load_esgf_pyclient_config():
cfg['search_connection']['cache'] = cache_file
Path(cache_file).parent.mkdir(parents=True, exist_ok=True)

missing_credentials = []
for key in ['hostname', 'username', 'password']:
if key not in cfg['logon']:
missing_credentials.append(key)

if missing_credentials and not cfg['logon'].get('interactive'):
logger.warning(INSTRUCTIONS)

return cfg


Expand Down

0 comments on commit 6f879cf

Please sign in to comment.