Bugfix/fix fernet after removal global in configuration #59958
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Had a longer research in iterations in our codebase why PR #59819 created a regression in retrieving variables as discussed in Slack (https://apache-airflow.slack.com/archives/C06K9Q5G2UA/p1767101218465539)
Root cause was due to refactoring I changed the default initialization of the fernet_key to be
Noneinstead of an empty string. This casued the config getter when checking to fallback whereNonewas actually passed as fallback but the config value defaults existed and while preparing the default it was attempted to expand variables in the defaults which had in this case not been iniitalized and the string formatter made"None"into the defaults which then prevented triggering a regeneration of a new fernet. Which then as using"None"(String) as Fernet caused variables to fail encoding in DB.Fix is to use empty string for fernet (as well to be consistent with JWT) as before PR #59819 - to be on the safe side removing the fallback and bad check for missing fernet being passed in config.
This PR fixes the regression and adds a test hoping that this does not happen again.