-
Notifications
You must be signed in to change notification settings - Fork 96
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
Merge syscfg.yml sections with the same name #198
Comments
This already works for me. I created a target called
When I view the config for this target, I see (truncated):
So the bug you saw might be more subtle. Could you please paste the output of |
Your syscfg does not have sections with the same name :-) What I meant is as follows:
In this case
Also it does not show up in target config:
It would be nice if settings from both |
I see what you mean. Not sure how I missed that in my initial reading! I do agree this would be an improvement. Taking the union of all these mappings, rather than replacing earlier definitions, eliminates some ambiguity This will require a change to the YAML parsing library. From a YAML-standards perspective, I think this change is OK. From my reading, I believe this is all the YAML specification has to say on the subject (http://yaml.org/spec/1.2/spec.html, 3.2.1.1):
So, it sounds like duplicate keys are undefined; the implementation can use its own discretion when it encounters them. |
I'm not familiar with YAML spec but googled a bit and it seems that duplicated keys are not allowed - I don't follow concepts in YAML spec so can't really argue here :-) Anyway, perhaps to make things simpler here and avoid changing YAML parser the same thing could be done with new key which define sections in file and settings from each sections would be then merged in "post processing", something like this:
This can be read with standard YAML parser and then settings from all sections would be merged with the same settings in "default" section. But I do not know if this makes implementation easier in any way as I did not dig into process of reading syscfg files in |
Would be nice if
newt
could merge multiple sections with the same name in single.yml
file instead of just using last one, especiallysyscfg.defs
andsyscfg.vals
. This could be useful in large configurations for BSPs or apps where many different features are (re)defined so splitting these settings into groups would improve readability.For example, I'd like to have clean up
syscfg.yml
a bit and do something like this:Currently it seems that 2nd
syscfg.vals
overwrites everything defined in 1stsyscfg.vals
(and the same forsyscfg.defs
)The text was updated successfully, but these errors were encountered: