Move template_server_configuration inside try/except#22151
Move template_server_configuration inside try/except#22151dannon wants to merge 2 commits intogalaxyproject:devfrom
Conversation
When OAuth2 vault secrets are missing, the configuration call itself can throw a ValidationError that wasn't caught. Initialize a default config first and move the call inside the existing try block.
|
Is this this the correct behavior ? Note that this happen when opening the configuration for the user defined file source for a subset of user defined file sources. In particular google drive, and importantly the vault secrets are not missing |
…ation The real crash is in template_server_configuration() when read_oauth2_info_from_configuration tries to construct OAuth2ClientPair with unresolvable environment variables (e.g. GALAXY_DROPBOX_APP_CLIENT_ID not set). This happens when viewing saved user file source configs, not when secrets are missing from the vault. Catch the error at the source and log a warning instead of 500ing.
|
Dug into it further — you're right that the vault secrets aren't the issue. The crash is in Updated the fix to catch the error in |
| template.configuration, user_details, environment | ||
| ) | ||
| except Exception: | ||
| log.warning( |
There was a problem hiding this comment.
I think the wording implies unix env vars ? I think that's just the environment section from the template (https://github.com/galaxyproject/usegalaxy-playbook/blob/main/env/common/files/galaxy/config/file_source_template_google_drive.yml#L9), maybe this needs rewording ? Did you test the fix ? And why does it only affect google drive ?
Summary
Fixes #22041 — the ValidationError happens in
template_server_configuration()whenread_oauth2_info_from_configurationtries to build anOAuth2ClientPairwith environment variables that aren't set (e.g.GALAXY_DROPBOX_APP_CLIENT_ID). This crashes when viewing saved user file source configs for OAuth2-based sources like Google Drive or Dropbox.The fix catches the error at the source in
template_server_configuration()rather than in_template_parameter_generation. When OAuth2 credentials can't be resolved, we log a warning and return aTemplateServerConfigurationwithoauth2_client_pair=None, which lets the rest of the configuration flow handle it gracefully.