Fix mgmt-framework rest server startup script#8260
Closed
sachinholla wants to merge 1 commit intosonic-net:masterfrom
Closed
Fix mgmt-framework rest server startup script#8260sachinholla wants to merge 1 commit intosonic-net:masterfrom
sachinholla wants to merge 1 commit intosonic-net:masterfrom
Conversation
PR sonic-net#4937 broke rest server startup -- server does not load user defined configs from db and always comes up with default config. Fixed mgmt_vars.j2 to load correct db entry and rest-server.sh to handle optional fields correctly. Also introduced a new jinja filter 'json' in sonic-cfggen. It formats the value using json.dumps() function. mgmt_vars.j2 tempalte uses this filter to transform db values into a syntactically correct json.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why I did it
Mgmt-framework REST startup script is broken after PR #4937. This PR misspells the table name as "RESET_SERVER"; hence the user defined settings from REST_SERVER table are never loaded. REST server always comes up with default settings.
Also the startup script rest-server.sh does not use the
jq -rcommands correctly. With -r option, it prints anullvalue when the field requested does not exists. Startup script would have assigned a "null" value for all non-configured parameters and would have failed (if it had spelt the table name correctly in mgmt_vars.j2).How I did it
Fixed mgmt_vars.j2 to load correct db entry and rest-server.sh to handle optional fields correctly.
Also introduced a new jinja filter "json" in sonic-cfggen, which formats the value using
json.dumps()function. The mgmt_vars.j2 template uses this filter to transform db values into a syntactically correct json.How to verify it
Verify REST server startup and a GET operation with following configurations:
Which release branch to backport (provide reason below if selected)
Description for the changelog