[config] config reload should generate sysinfo if missing #3031
Merged
wen587 merged 6 commits intosonic-net:masterfrom Nov 2, 2023
Merged
[config] config reload should generate sysinfo if missing #3031wen587 merged 6 commits intosonic-net:masterfrom
wen587 merged 6 commits intosonic-net:masterfrom
Conversation
…ing (sonic-net#2778)" (sonic-net#2865)" This reverts commit 7d803ae.
2aebe51 to
659f8b8
Compare
ganglyu
reviewed
Nov 1, 2023
ganglyu
reviewed
Nov 1, 2023
ganglyu
approved these changes
Nov 1, 2023
StormLiangMS
pushed a commit
that referenced
this pull request
Nov 2, 2023
What I did Missing platform and mac in CONFIG_DB will result in container failure. We should make the config reload generate those info if missing. How I did it Add missing sys info if config_db.json doesn't contain it. How to verify it Unit test
wen587
added a commit
to wen587/sonic-utilities
that referenced
this pull request
Jan 18, 2024
…3031) What I did Missing platform and mac in CONFIG_DB will result in container failure. We should make the config reload generate those info if missing. How I did it Add missing sys info if config_db.json doesn't contain it. How to verify it Unit test
qiluo-msft
reviewed
Jan 18, 2024
| with open(fileName, 'w') as f: | ||
| json.dump(json_input, f, indent=4) | ||
| except Exception as e: | ||
| raise Exception(str(e)) |
Contributor
There was a problem hiding this comment.
except and raise immediately does not add value. It is the same as no except at all.
qiluo-msft
reviewed
Jan 18, 2024
| # Save to tmpfile in case of stdin input which can only be read once | ||
| if file == "/dev/stdin": | ||
| file_input = read_json_file(file) | ||
| (_, tmpfname) = tempfile.mkstemp(dir="/tmp", suffix="_configReloadStdin") |
Contributor
There was a problem hiding this comment.
Look around the login inside this function, it seems one time reading of file will be enough. Let's take further effort to reorg the existing code and optimize the logic.
Contributor
Author
There was a problem hiding this comment.
sonic-cfggen -j read it first. Then sonic-cfggen read it second.
nmoray
pushed a commit
to nmoray/sonic-utilities
that referenced
this pull request
Jun 25, 2025
…3031) What I did Missing platform and mac in CONFIG_DB will result in container failure. We should make the config reload generate those info if missing. How I did it Add missing sys info if config_db.json doesn't contain it. How to verify it Unit test
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.
ADO:17746072
What I did
Missing platform and mac in CONFIG_DB will result in container failure. We should make the config reload generate those info if missing.
How I did it
Add missing sys info if config_db.json doesn't contain it.
How to verify it
Unit test
Previous command output (if the output of a command-line utility has changed)
New command output (if the output of a command-line utility has changed)