-
Notifications
You must be signed in to change notification settings - Fork 28
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
Fixes profile merge order to match Node.js SDK #203
Conversation
Signed-off-by: aadityasinha-dotcom <[email protected]>
Signed-off-by: aadityasinha-dotcom <[email protected]>
Signed-off-by: aadityasinha-dotcom <[email protected]>
Signed-off-by: Aaditya Sinha <[email protected]>
Codecov ReportAttention:
... and 1 file with indirect coverage changes 📢 Thoughts on this report? Let us know!. |
for i, (config_type, cfg) in enumerate(config_layers.items()): | ||
loaded_cfg = always_merger.merge(loaded_cfg, cfg.profiles) |
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 did use the deepmerge
library so that it can merge each layer as a whole config
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.
Not all config layers can be merged with the same merger function. See the Node.js SDK for how profiles of each layer should be merged:
- Project and Project User are deep merged into a temporary Project Merged layer
- Global and Global User are deep merged into a temporary Global Merged layer
- Add profiles to Project Merged layer which are only present in Global Merged layer
for i, (config_type, cfg) in enumerate(config_layers.items()): | ||
loaded_cfg = always_merger.merge(loaded_cfg, cfg.profiles) |
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.
Not all config layers can be merged with the same merger function. See the Node.js SDK for how profiles of each layer should be merged:
- Project and Project User are deep merged into a temporary Project Merged layer
- Global and Global User are deep merged into a temporary Global Merged layer
- Add profiles to Project Merged layer which are only present in Global Merged layer
Signed-off-by: aadityasinha-dotcom <[email protected]>
Signed-off-by: Aaditya Sinha <[email protected]>
Signed-off-by: Aaditya Sinha <[email protected]>
Signed-off-by: aadityasinha-dotcom <[email protected]>
Signed-off-by: Aaditya Sinha <[email protected]>
@t1m0thyj please review this PR |
# Creating copies of the usrProject and project objects | ||
usrProjectCopy = deepcopy(usrProject) | ||
projectCopy = deepcopy(project) | ||
prjt = always_merger.merge(usrProject, project) | ||
|
||
usrGlobal = self.global_user_config.profiles | ||
glbal = self.global_config.profiles | ||
|
||
# Creating copies of the usrGlobal and glbal objects | ||
usrGlobalCopy = deepcopy(usrGlobal) | ||
glbalCopy = deepcopy(glbal) |
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 have created the copies using deepcopy
for the objects before getting merged
Signed-off-by: Aaditya Sinha <[email protected]>
Signed-off-by: Timothy Johnson <[email protected]>
Signed-off-by: Timothy Johnson <[email protected]>
Signed-off-by: Timothy Johnson <[email protected]>
Signed-off-by: Timothy Johnson <[email protected]>
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'm having a tough time trying to find differences in behavior with the NodeJS SDK.
LGTM! 😋
What It Does
Resolves #190
How to Test
Review Checklist
I certify that I have:
Additional Comments