-
Notifications
You must be signed in to change notification settings - Fork 145
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
Fix configuration migrations to work for peripheral connectors #1830
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving because this generally looks good to me and we want to get this into today's BC.
missing_fields = simple_config.keys() - current_config.keys() | ||
fields_missing_properties = filter_nested_dict_by_keys( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can avoid checking both missing_fields
and fields_missing_properties
:
Instead of checking
for config_name, config_obj in current_config.items():
for k, v in config_obj.items():
simple_default_value = simple_default_config.get(config_name, {}).get(k)
We can check the default config first:
for config_name, config_obj in simple_default_config.items():
for k, v in config_obj.items():
current_value = current_config.get(config_name, {}).get(k)
This will make sure it covers both missing fields and missing properties
…#1830) (#1833) Co-authored-by: Navarone Feekery <[email protected]>
…#1830) (#1834) Co-authored-by: Navarone Feekery <[email protected]>
This PR is to address a bug with RCF validations/migrations.
When a connector is missing a configuration field, it should be added automatically when it is validated. However, this doesn't work for connectors that are not the "main" connector (defined by id in by config file). This bug most often appears for native connectors, but can also occur for self-managed connectors.
The code here was complicated and I think prone to bugs, so the fix also required a refactor. Any connector being sent through the
prepare
function should now have its configuration validated for both fields and field properties. Connectors are not treated too differently, so they can all follow the same logic path.This fix: