HDFGroup / h5pyd

h5py distributed - Python client library for HDF Rest API
Other
109 stars 39 forks source link

Fix parsing of Keycloak-related client configuration options #207

Open kerberizer opened 2 days ago

kerberizer commented 2 days ago

This pull request addresses two issues.

Issue 1: Keycloak Configuration Parsing

The pull request enables parsing of the client configuration when Keycloak-related options are present. Specifically, it now supports the following options:

Previously, client commands would fail with a confusing error message like the following:

Traceback (most recent call last):
  File "(...)/bin/hsls", line 5, in <module>
    from h5pyd._apps.hsls import main
  File "(...)/site-packages/h5pyd/_apps/hsls.py", line 17, in <module>
    cfg = Config()
          ^^^^^^^^
  File "(...)/site-packages/h5pyd/_apps/config.py", line 130, in __init__
    raise ValueError(f"undefined option: {name}")
ValueError: undefined option: ignore

Issue 2: Correcting ValueError Parameter

The second issue is related to the ValueError exception above, which was using the incorrect parameter. The name variable was mistakenly used, leading to confusion, as it was actually a list of known options generated earlier in the code (see this line, where it gets last set to ignore, the last option in default_cfg). The pull request corrects this by using the k variable, which holds the current option name being parsed (v holds the value).

If additional subkeys (e.g., flags) need to be added to the new default_cfg keys, please advise on where to find the necessary information.