Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show error information from APEL token endpoint #1123

Merged
merged 4 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Docs: Correct and enhance HTCondor collector documentation (#1021) ([@rfvc](https://github.com/rfvc))
- HTCondor collector: Fix config check for entries which do not contain a `name` field (#1021) ([@rfvc](https://github.com/rfvc))

- Apel plugin: Improved error messages when fetching security tokens ([@maxfischer2781](https://github.com/maxfischer2781))

### Removed

## [0.7.0] - 2025-01-27
Expand Down
17 changes: 6 additions & 11 deletions plugins/apel/src/auditor_apel_plugin/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,23 +442,18 @@ def get_token(config):
client_cert = config.authentication.client_cert
client_key = config.authentication.client_key
verify_ca = config.authentication.verify_ca

if verify_ca:
ca_path = config.authentication.ca_path
else:
ca_path = False
ca_path = config.authentication.ca_path if verify_ca else False

try:
response = requests.get(
auth_url, cert=(client_cert, client_key), verify=ca_path, timeout=10
)
except requests.Timeout:
logger.critical("Timeout while getting token")
response.raise_for_status()
except requests.RequestException as e:
logger.critical(f"Could not get authentication token - {e}")
raise

token = response.json()["token"]

return token
else:
return response.json()["token"]


def sign_msg(config, msg):
Expand Down
Loading