connection_options extra gathering in a merged way #759
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.
Rewrote
get_connection_options
logic in a way thatdefaults
,group
andhost
connection_options.extra
parameters will be merged. Priority isdefaults
->group1
,group2
,... ->host
So a host defined extra parameter would override defaults or groups if the key is the same. All distinct parameters will be merged together.
Benefits
We can better segment our
connection_options
extra parameters. We can define partial extras in defaults, groups and hosts.Downside of the new logic
If a user relies on that host defined extra will not merge but replace the default/groups, then the user might get additional parameters which might be unexpected.
Example
defaults.yaml:
hosts.yaml:
Old behavior
This will result in that host1 will NOT have the
secret
parameter. Host file replace the extras.New behavior
host1 will have set the port 222 and the secret set as well. Host file will merge the extras.
TODO
Although I completed tests with the new behavior, I did not do production testing. I'm curious if this all would be interesting to merge into the project. If there is a chance, then I'd work on: